Mega Code Archive

 
Categories / C / Code Snippets
 

Use gets to get the whole string

#include <stdio.h> int main(void) { char str[100]; printf("Enter a string (less than 100 chars): "); gets(str); printf(str); /* output the string */ return 0; }