Advertisement
metalx1000

Get User Input String

Aug 8th, 2017
630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.   /* A nice long string */
  5.   char string[256];                              
  6.  
  7.   printf( "Please enter your name: " );
  8.   /* notice stdin being passed in */
  9.   fgets ( string, 256, stdin );          
  10.  
  11.   printf( "Hello %s", string );
  12.  
  13.   printf("Press <ENTER> to continue...");
  14.   getchar();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement