Possible Duplicate:
How do you allow spaces to be entered using scanf?
char inputStr[64];
int inputInt;
printf("Enter a number:");
scanf("%d",&inputInt);
printf("\nEnter a string:");
scanf("%s",&inputStr);
The above code has 2 part, reading a integer and string.
Reading an integer is fine.
Reading a string also fine considering characters are under 64 and there is no SPACE.
That is the problem.
scanf
only reads the character up to a space.
Everything after the space is gone.
How can I include the space also in scanf?