I know C++, but I'm trying to learn C. Anyways, what am I doing wrong here. If I delete the line with 'scanf', it will compile so obviously I'm doing something wrong there. Anyways...

#include <stdio.h>


int main() {

	int x;

	printf("enter a number\n");
	scanf("%d", &x);
	printf("Your number is: %d\n", x);
	return 0;
}

Just compiled and ran your code using gcc, it worked fine.

I found my error but I have a question about it. My executable is blank until I enter a number. Once, I enter a number then all my printf's show up declaring enter a number and your number is _. How do I fix this? This is what my output looks like.

6
enter a number
Your number is: 6

Im using Code::Blocks and run well! IDK you! Try another compiler!

After googling in eclipse forums, this is a known bug within the program. The fix is adding this under main.

setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);