Register | Sing In

New posts

Stacks in C programming Linked Lists in C programming File Input/Output in C programming Check prime numbers in C Programming C Programming Enumeration C Programming Union

Archives

2013-10 2013-09 2013-08

Sizeof Operator in C Programming

September 5, 2013 Posted by: GPA Views: 620 0 comments

Problem

What does Sizeof Operator do in C?

Solution

C provides the special unary operator sizeof to determine the size in bytes of  any data type. This article demonstrate you  the sizeof operator in C. This program below calculates the number of bytes used to store each of the standard data types of C.

Example:

   

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
   printf( "sizeof(char) = %d"
     "\nsizeof(short) = %d"
    "\nsizeof(int) = %d"
    "\nsizeof(long) = %d"
    "\nsizeof(float) = %d"
    "\nsizeof(double) = %d"
    "\nsizeof(long double) = %d\n\n", sizeof( char ), sizeof( short ),sizeof( int ),
sizeof( long ),
 sizeof( float ), sizeof( double ), sizeof(long double ));
    system("PAUSE");
   return 0;
}

Output

Sizeof Operator in C Programming

Download this example

0 Comments...

Leave a Reply

Please, Sing In to leave a Reply for this material.



Online Chat

LiveZilla Live Help

Popular posts

Function strtok in C programming Check prime numbers in C Programming C Programming Union Linked Lists in C programming File Input/Output in C programming C Programming Enumeration

RSS-subscribe

New materials

Subscribe