- #include<iostream>
- using namespace std;
- int main() {
- int a; // declaration
- a=12; // initialisation
- cout<<"size of int "<<sizeof(a)<<endl;
- float b;
- cout<<"size of float "<<sizeof(b)<<endl;
- char c;
- cout<<"size of char "<<sizeof(c)<<endl;
- bool d;
- cout<<"size of bool "<<sizeof(d)<<endl;
- short int si;
- long int li;
- cout<<"size of short_int "<<sizeof(si)<<endl;
- cout<<"size of long_int "<<sizeof(li)<<endl;
- return 0;
- }
Raw Paste