C examples for String:char array
Using Pointers to Find the Length of a String
#include <stdio.h> int stringLength (const char *string){ const char *cptr = string; while ( *cptr ) ++cptr;/*from ww w.ja v a 2s. co m*/ return cptr - string; } int main (void) { int stringLength (const char *string); printf("%i ", stringLength ("test test test test")); printf("%i ", stringLength ("")); printf("%i ", stringLength ("complete")); return 0; }