What will the given code print?
#include <iostream>

struct A {
  char a;
  int b;
  char c;

int main() {
  std::cout << sizeof(A);
The size of the int type varies on different platforms. The size of the structure containing data types of various sizes depends on the type of alignment used by the compiler. The type of alignment may depend on the compiler settings.
Read more: Typical alignment of C structs on x86

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes