Code:#include <stdio.h> #include <conio.h> int main() { char s[100]; int i=0; //fgets(s,100,stdin); gets(s); while ( s[i] != '\0' ) i++; printf("%d",i); getch(); return 0; }
when i use gets the output is same as number of characters in the string but using fgets gives value more by 1... example: input is "Kiran".. using gets gives output 5 but using fgets, it gives 6.