fork download
  1. #include <iostream>
  2. #include <cstddef>
  3. using namespace std;
  4.  
  5. class A
  6. {
  7. char b;
  8. int c;
  9. };
  10.  
  11. int main() {
  12. std::cout << offsetof(A, c) << std::endl;
  13. return 0;
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
In file included from /usr/include/c++/6/cstddef:50:0,
                 from prog.cpp:2:
prog.cpp: In function ‘int main()’:
prog.cpp:12:27: error: ‘int A::c’ is private within this context
  std::cout << offsetof(A, c) << std::endl;
                           ^
prog.cpp:8:6: note: declared private here
  int c;
      ^
stdout
Standard output is empty