Friday, 28 February 2014

Write a C Program for using data types in c


Write a C Program for using data types in c



   #include <stdio.h>
   main()
  {

   int a;
   char b;
   float c;
   double d;
   long e;
   short f;
   signed g;
   unsigned h;
   clrscr();
   printf(" size for int data type:%d \n",sizeof(a));
   printf(" size for char data type:%d \n",sizeof(b));
   printf(" size for float data type:%d \n",sizeof(c));
   printf(" size for double data type:%d\n",sizeof(d));
   printf("size for long data type:%d\n",sizeof(e));
   printf("size of short data type:%d\n",sizeof(f));
   printf("size of signed data type:%d\n",sizeof(g));
   printf("size of unsigned data type:%d\n",sizeof(h));
   getch();
   return 0;
}



Output:-
Size for int data type: 2
Size for char data type:1
Size for float data type:4
Size for double data type:8
Size for long  data type:4
Size for short data type:2
Size for signed data type:2
Size for unsigned data type:2

No comments: