Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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;
- }
- //Output
- size of int 4
- size of float 4
- size of char 1
- size of bool 1
- size of short_int 2
- size of long_int 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement