Mega Code Archive

 
Categories / C Tutorial / Printf Scanf
 

Read string from keyboard

#include <stdio.h> #include <string.h> int main(void) {   char word1[20];   printf("\nType in the first word:\n 1: ");   scanf("%19s", word1);   printf("%19s",word1);      return 0; } What is your name?Tom Darn glad to meet you, Tom!