Write a program that demonstrates the use of %s conversion specifier in scanf( ).

C Programming Language / String in C Language

791

Program:

#include <stdio.h>

int main()
{
  char str[50];

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

  printf("The string was :%s\n",str);

  return 0;

 }

Output:

Enter a string  atnyla
The string was :atnyla

Explanation:

None

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.