Read string: A simple scanf and printf pair : Console Read String : Console : C / ANSI-C examples (example source code) Organized by topic

C / ANSI-C
C++
PHP
C / ANSI-C Home »  Console   » [  Console Read String  ]  Screenshots 
 



Read string: A simple scanf and printf pair

  
#include <stdio.h>

int main(void)
{
  char str[80];

  printf("Enter a string: ");
  scanf("%s", str);
  printf(str);

  return 0;
}


           
       
Related examples in the same category
1.  Use fgets to read string from standard input
2.   Get a string from stdin: how to use gets
3.   Read formatted data from string: how to use sscanf
4.  Get string from console and output it
5.  Get string from console and assign it to a char pointer