One question about printf()

Does printf() can't print a integer?
e.g:
int t = 3;
printf(t);

Help!!
Of course it can! Here are couple of examples

1
2
3
4
5
6
7
8
 
int a = -4; 
int b = 10; 
printf("%d \n", a); 
printf("%d \n", b); 

unsigned int c = 6; 
printf("%u", c); 


Just make sure you use the right specificator.

You need to have a format string.

i.e.
 
printf("%i",t);


t will be printed where the %i is.
Last edited on
Thanks!
Topic archived. No new replies allowed.