|
Description
This example displays
the field width modifiers with the
printf function
Code
/*this example
displays field width modifiers
with the printf function*/
#include <stdio.h>
main()
{
int sampleint = 974;
/*normal display*/
printf(":%d:\n",sampleint);
/*ten spaces before the integer*/
printf(":%10d:\n",sampleint);
/*ten spaces after the integer*/
printf(":%-10d:\n",sampleint);
return 0;
}
Information
tested with Visual C++
6
|