How does Sizeof operator works??? | SoloLearn: Learn to code for FREE!

+1

How does Sizeof operator works???

1/2/2017 12:37:04 PM

Kennedy Kamande Wangari

1 Answer

New Answer

+6

Function sizeof() eturns size in bytes of the variable of some type. E.g. #include <iostream> using namespace std; int main() { cout << sizeof(char) << endl; cout << sizeof(int) << endl; cout << sizeof(string) << endl; cout << sizeof(bool) << endl; return 0; } // outputs // 1 // 4 // 4 // 1 Further reference: http://en.cppreference.com/w/cpp/language/sizeof