Mega Code Archive

 
Categories / C / Code Snippets
 

Get the string length

#include <stdio.h> #include <string.h> int main(void) { char str[100]; gets(str); printf("Length is %d", strlen(str)); return 0; }