all about computer science
Wednesday, 8 April 2015
How to read a string with spaces using scanf
How to read a string with spaces using scanf
#include<stdio.h>
void main()
{
char str[100];
printf("Enter any string\n");
scanf("%[^\n]s",str);
//<----- Imp step--------
printf("\n You entered string %s \n",str);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment