printf in C
-
Hai, I want to print % symbol in my printf statement.. eg : printf(" Error is %.2f %",val); ie it should print Error is 5.00% How should I do this?? thanks.
-
Hai, I want to print % symbol in my printf statement.. eg : printf(" Error is %.2f %",val); ie it should print Error is 5.00% How should I do this?? thanks.
Using %% in the format string will output a single % symbol. So your format string should be
" Error is %.2f %%"
.Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Using %% in the format string will output a single % symbol. So your format string should be
" Error is %.2f %%"
.Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
Or use %c in the format string
printf(" Error is %.2f %c",val,'%');
Regards, Andrzej MarkowskiMy Latest ArticlesCCustomBitmapButton: An owner-draw button and a frame for the caption bar, in one class. CCustomTabCtrl: A clone of the Excel tab sheet control.