Read and output string : Console Output String « Console « C / ANSI-C






Read and output string


#include <stdio.h>

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

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

  return 0;
}

  

           
       








Related examples in the same category

1.Displaying a string
2.Displaying a Quotation: the main function
3.prints Hello on standard output
4.Print the string in the reverse order
5.Output string to console
6.A simple example for printf
7. Output a string to stdout: how to use puts