Notices
 

fgets() Reads a String through the Keyboard

For page specific messages
For page author info

Using gets() for taking input in C gives some warning. To avoid this, we used fgets() method. It is very interesting and easy to use.


#include <stdio.h>

int main()

{  

char name[10];  

printf("Who are you? \n");  

fgets(name,10,stdin);  

printf("Good to meet you, %s.\n",name);  

return(0);

}

 
X