C Program to accept the string with spaces
#include<stdio.h>
int main()
{
char a[101];
printf("enter a string : ");
scanf("%[^\n]",&a);
printf("%s",a);
return 0;
}
Output:
Explanantion:
Hi, in this program using this "%[^\n]" the string is accepted
until the next line is entered and we are printing the string
using printf function.
Tags:
c programming examples