C++
How much m ...
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
How much memory does an empty class object take?
0 byte
1 byte
4 bytes
Depends on the platform
Explanation
According to the standard, the size of an object cannot be equal to 0, so the size of an object is equal to the size of 1 char.
class
sizeof
memory
memory allocation
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
Related Content
Чему равен sizeof(A) на 32-х разрядной платформе, где A имеет следующее описание: class A { int a; char ch; double d; virtual void f() = 0; };
Какой из двух классов занимает больше памяти в C++: class A{ int i; int foo(int a); }; Class B{ int i; virtual int boom(int b); };
Что напечатает кусок кода: enum : { RED, GREEN, BLUE }; cout << sizeof(RED) << endl;
32-х битная система. Что выведет программа: int main() { char a[] = "Hello"; char *ptr = a; std::cout << sizeof(a); ptr++; std::cout << sizeof(++ptr); std::cout << *ptr; }
Что напечатает приведенный код? #include <iostream> struct A { char a; int b; char c; }; int main() { std::cout << sizeof(A); }
C
++
Quiz
Login to learn C++
or
Read more about
C++ Quizzes
Follow CodeGalaxy
Mobile Beta
Send Feedback
Keep exploring
C++ quizzes
int main() { const int* i = int(); // 1 int const* j = int(); //2 int* const k = int(); //3 int* l(); //4 ++i; //5 ++j; //6 ++k; //7 ++*k; //8 ++l; //9 } Откомпилируется ли такой код? Если нет, то в каких строчках будут ошибки компиляции? После стандарта C++14.
Какой результат работы программы? #include <iostream> using namespace std; void f(double) { cout<<"f1"<<endl; } void f(const int ) { cout<<"f2"<<endl; } void f( int & ) { cout<<"f3"<<endl; } void main(void) { int n = 1; double b = 2; f(n); f(b); }
#include <iostream> using namespace std; int &test() { static int a = 3; return a; } int main() { ++++++test(); cout << test() << endl; return 0; } Что выведет cout?
При истинности какого из приведенных высказываний имеет смысл вычитание указателей?
Какое ключевое слово используется для описания пространства имен?
В чем разница между X x; и X x(); ?
Sign Up Now
or
Subscribe for future quizzes
Login in to like
Login in to comment