A Collection Of Technical Questions. Study & Apply.
Example:Class A{ int IntVariable; void PrintContent( void ) { cout << endl << IntVariable << endl; };}
pinnetega thammbi
size of an empty class/ struct is always equals to a char variable in VC++, int variable in TC++.Example:struct MyEmptyStructure { };MyEmptyStructure stTestEmptyStructure;class MyEmptyClass { };cout << "sizeof ( MyEmptyStructure ) = " << sizeof ( MyEmptyStructure ) << "\n"; // Output in VC++ = 1, in TC++ = 2.cout << "sizeof ( stTestEmptyStructure ) = " << sizeof ( stTestEmptyStructure ) << "\n"; // Output in VC++ = 1, in TC++ = 2.
Post a Comment
2 comments:
pinnetega thammbi
size of an empty class/ struct is always equals to a char variable in VC++, int variable in TC++.
Example:
struct MyEmptyStructure
{
};
MyEmptyStructure stTestEmptyStructure;
class MyEmptyClass
{
};
cout << "sizeof ( MyEmptyStructure ) = " << sizeof ( MyEmptyStructure ) << "\n"; // Output in VC++ = 1, in TC++ = 2.
cout << "sizeof ( stTestEmptyStructure ) = " << sizeof ( stTestEmptyStructure ) << "\n"; // Output in VC++ = 1, in TC++ = 2.
Post a Comment