cparadis6191
01-29-2010, 03:31 AM
Hi guys,
I'm in a C programming class (just starting the class) in college and I'm having a little problem. I usually use eclipse at the machines running Fedora 12 at school. I set up eclipse on my home pc (running 7) with MinGW and msys as a compiler. To test to see if my compiler was working I wrote the following code... What I want to show up is something like this.
Run code:
Input a value to be printed: 123
a = 123
What happens is this:
123
Input a value to be printed:
a = 123
The first printf statement happens after I input the value... do different compilers have different priorities for functions? specifically printf and scanf? thanks in advance.
Here's the code.
#include<stdio.h>
int main()
{
int a;
printf("Input a value to be printed:\n");
scanf("%d", &a);
printf("a = %d", a);
return 0;
}
I'm in a C programming class (just starting the class) in college and I'm having a little problem. I usually use eclipse at the machines running Fedora 12 at school. I set up eclipse on my home pc (running 7) with MinGW and msys as a compiler. To test to see if my compiler was working I wrote the following code... What I want to show up is something like this.
Run code:
Input a value to be printed: 123
a = 123
What happens is this:
123
Input a value to be printed:
a = 123
The first printf statement happens after I input the value... do different compilers have different priorities for functions? specifically printf and scanf? thanks in advance.
Here's the code.
#include<stdio.h>
int main()
{
int a;
printf("Input a value to be printed:\n");
scanf("%d", &a);
printf("a = %d", a);
return 0;
}