C examples for String:char array
Uses pointer to print the ASCII values associated with the characters contained in a string.
#include <string.h> #include <stdio.h> int main(void) { char *p1;//from w w w.j a v a 2s .c om char s[80]; do { p1 = s; /* reset p1 to beginning of s */ gets_s(s); /* read a string */ /* print the decimal equivalent of each character */ while (*p1) printf(" %d", *p1++); } while (strcmp(s, "done")); return 0; }