We can know the memory usage of a given type using the sizeof operator. It takes either a variable name or a type name as parameter.

#include <iostream>
int main(int argc, char **argv) {
int n;
cout << sizeof(n) << ’ ’ << sizeof(double) << ’\n’;
}

The result is 4 8.
Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates