#include <stdio.h> #include <string.h> int main (void) { char ss[20] = "hello world"; int length = strlen(ss); int i; printf ("strlen is %i\n", length); for ( i = 0; i < length ; ++ i ) printf ("iam at char count %i\n", i); return 0; }
===== output ===== strlen is 11 iam at char count 0 iam at char count 1 iam at char count 2 iam at char count 3 ... iam at char count 10