char nation[100];
printf("Enter Your Name : ");
gets(nation);
int size = strlen(nation);
printf("Output = %f\n", size);
I need to solve the question, please.
char nation[100];
printf("Enter Your Name : ");
gets(nation);
int size = strlen(nation);
printf("Output = %f\n", size);
I need to solve the question, please.
 
    
    char nation[100];
printf("Enter Your Name : ");
fgets(nation, sizeof(nation), stdin);  //gets is depreciated use fgets instead
size_t size = strlen(nation);    //strlen returns size_t not int
printf("Output = %zu\n", size);  //%f is to print floats
You need to tell printf what type you want to print:
%c  character
%d  decimal (integer) number (base 10)
%e  exponential floating-point number
%f  floating-point number
%i  integer (base 10)
%o  octal number (base 8)
%s  a string of characters
%u  unsigned decimal (integer) number
%x  number in hexadecimal (base 16)
%%  print a percent sign
