Programs on short int data type in C

This Programs on short int data type in C Language page provides all the technical programs to be perfect in integer data types in C programming language. This page also provides clearly diagrammatic representation of programs execution.


 

Basic code to print a short value :

#include<stdio.h>
main()
{
short a=10 ;
printf(“a : %d\n”,a);
}

 

Short data will be processed and displayed according to short limits as shown below :

 

#include<stdio.h>
main()
{
                short a = 32769 ;
                printf(“a : %d\n”,a);
}

 

#include<stdio.h>
main()
{
                short a = 32769 ;
                printf(“a : %u\n”,a);
}

 

#include<stdio.h>
main()
{
                unsigned short int a = -5 ;
                printf(“a : %u\n”,a);
}

 

#include<stdio.h>
main()
{
                short int a = 65538 ;
                printf(“a : %u\n”,a);
                printf(“a : %d\n”,a);
}

 

#include<stdio.h>
main()
{
                unsigned short int a = -32774 ;
                printf(“a : %u\n”,a);
                printf(“a : %d\n”,a);
}

Share this