Finding the size of a type : Variable « Language Basics « C / ANSI-C






Finding the size of a type

Finding the size of a type

/* Finding the size of a type  */
#include <stdio.h>

void main()
{
  printf("\n  char occupy %d bytes", sizeof(char)); 
  
  printf("\n short occupy %d bytes", sizeof(short)); 
  
  printf("\n int occupy %d bytes", sizeof(int)); 
  
  printf("\n long occupy %d bytes", sizeof(long)); 
  
  printf("\n float occupy %d bytes", sizeof(float)); 
  
  printf("\n double occupy %d bytes", sizeof(double)); 
  
  printf("\n long double occupy %d bytes", sizeof(long double)); 
 }


           
       








Related examples in the same category

1.demonstrate the use of variables
2.For and scanf
3.the variable limitsthe variable limits