All pastes #89584 Raw Edit

Anonymous

public cpp v1 · immutable
#89584 ·published 2006-07-16 20:03 UTC
rendered paste body
#include <iostream>using namespace std;void main(){  bool b;  char c;  int n;  long l;  float f;  double d;  cout << "sizeof a bool = " << sizeof b << endl;  cout << "sizeof a char = " << sizeof c << endl;  cout << "sizeof a int = " << sizeof n << endl;  cout << "sizeof a long = " << sizeof l << endl;  cout << "sizeof a float = " << sizeof f << endl;  cout << "sizeof a double = " << sizeof d << endl;  cout << endl << endl;  cout.setf(ios::hex);      //show decimals as hex  cout.unsetf(ios::dec);  cout << "address of bool = " << &b << endl;  cout << "address of char = " << &c << endl;  cout << "address of int = " << &n << endl;  cout << "address of long = " << &l << endl;  cout << "address of float = " << &f << endl;  cout << "address of double = " << &d << endl << endl;  system("pause");}The output:sizeof a bool = 1sizeof a char = 1sizeof a int = 4sizeof a long = 4sizeof a float = 4sizeof a double = 8address of bool = 12ff8baddress of char =address of int = 12ff84address of long = 12ff80address of float = 12ff7caddress of double = 12ff74Press any key to continue . . .