int i = 11/2;
printf("i is %d\n",i);
Result is "i is 5".
I expected this, but just making sure. Changing %d to %f makes it print "i is 0.000000", which I also expected since any int you're trying to print as a float comes out as 0 like that. There's probably a reason for this, but I'd have not guessed it not knowing any better (meaning I had tried it before).
No comments:
Post a Comment