TEXT   40
sizeof a
Guest on 19th September 2023 11:09:18 AM


  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int a; // declaration
  6.     a=12; // initialisation
  7.  
  8.     cout<<"size of int "<<sizeof(a)<<endl;
  9.  
  10.     float b;
  11.     cout<<"size of float "<<sizeof(b)<<endl;
  12.  
  13.     char c;
  14.     cout<<"size of char "<<sizeof(c)<<endl;
  15.  
  16.     bool d;
  17.     cout<<"size of bool "<<sizeof(d)<<endl;
  18.  
  19.     short int si;
  20.     long int li;
  21.     cout<<"size of short_int "<<sizeof(si)<<endl;
  22.     cout<<"size of long_int "<<sizeof(li)<<endl;
  23.  
  24.     return 0;
  25. }

Raw Paste

Login or Register to edit or fork this paste. It's free.