| Author |
Message |
|
|
|
Post subject: A problem with Eclipse CDT plugin
Posted: Jun 20, 2008 - 02:53 AM
|
|
Joined: Jun 20, 2008
Posts: 1
|
|
It seems there's something wrong when I use the "scanf" function.
Here's my code:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
char name[20];
printf("Please enter your name:");
scanf("%s",name);
printf("%s says, Hello World",name);
EXIT_SUCCESS;
}
After building, I run the program. But the console doesn't display anything. The expecting result should be:
Please enter your name:aaa
aaa says, Hello World
But when I input "aaa" in the empty console,it displays:
Please enter your name:aaa says, Hello World
So the function "scanf" runs before the first "printf".
Anyone who can tell me how to resolve this problem? |
|
|
| |
|
|
|
 |
|
|
| |