Mega Code Archive

 
Categories / C Tutorial / Stdio h
 

Gets() reads in only text

It reads everything typed at the keyboard until the Enter key is pressed. #include <stdio.h>   int main(){     char name[20];       printf("Name:");     gets(name);     printf("%s \n",name);     return(0); } Name:1 1 gets(var) is the same as scanf("%s",var).