Hi,
I am trying to run my first C program on Keil...it works perfectly until I insert a printf statement...am i missing something?
#include <reg52.h> #include <stdio.h> void main(void) { unsigned int i; unsigned int ans = 0; for (i =0; i< 5; i++) { ans += 2; } printf("The answer is: " + ans); }
Probably because some thing(s) need to be set up before you can use printf; eg, where do you expect the output from printf to appear...?
This will depend upon which particular compiler you are using - another detail that you have omitted to mention!
I suggest that you start with the "Hello, world" example provided with your compiler...
http://www.keil.com/support/man/docs/gs/
http://www.keil.com/support/man/docs/uv3/uv3_examples.htm