Set width for int value output in printf - C Data Type

C examples for Data Type:int

Description

Set width for int value output in printf

Demo Code

#include <stdio.h>
int main(void)
{
    int jane, tarzan, cheeta;
    //from w  w  w .  j  a  va  2  s  .c  o  m
    cheeta = tarzan = jane = 68;
    printf("                  cheeta   tarzan    jane\n");
    printf("First round score %4d %8d %8d\n",cheeta,tarzan,jane);
    
    return 0;
}

Result


Related Tutorials