C examples for String:String Function
Create your own function to get the length of a string
#include <stdio.h> /* return length of s */ int strlen(char s[]){ int i = 0;/* w ww . jav a 2s .co m*/ while (s[i] != '\0') ++i; return i; } int main(){ char buf[1000]; while (fgets(buf, sizeof buf, stdin) != NULL) printf("%d%s", strlen(buf), buf); return 0; }