Switch to full style
C++ code examples
Post a reply

Sizeof Operator

Thu Nov 13, 2008 2:25 pm

Sizeof keyword usage in C++
cpp code
/*
* Print the sizeof information for the basic numeric types.
*/

#include <stdio.h>
main()
{
char c;
short s;
int i;
unsigned long l;
signed long long ll;

float f;
double d;
long double ld;

printf ("%d %d %d %d %d\n", (int)sizeof c, (int)sizeof s,
(int)sizeof i, (int)sizeof l, (int)sizeof ll);
printf ("%d %d %d\n", (int)sizeof f, (int)sizeof d, (int)sizeof ld);
printf ("%d %d %d\n", (int)sizeof(int), (int)sizeof(char),
(int)sizeof(long double));
}




Post a reply
  Related Posts  to : Sizeof Operator
 how to find size without using sizeof     -  
 operator int()     -  
 Using the ? Operator     -  
 What is the % operator     -  
 Object without new Operator     -  
 trinary operator     -  
 stream operator     -  
 What is Operator Overloading? !!!     -  
 operator overloading     -  
 Operator Precedence table     -  

Topic Tags

C++ Basics