fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct stEstructura {
  5. int a, b;
  6. } estructura, *e;
  7.  
  8. int main() {
  9. estructura.a = 10;
  10. estructura.b = 32;
  11. e = &estructura;
  12.  
  13. cout << "puntero" << endl;
  14. cout << *e.a << endl;
  15. cout << e->b << endl;
  16. cout << "objeto" << endl;
  17. cout << estructura.a << endl;
  18. cout << estructura.b << endl;
  19.  
  20. return 0;
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14:15: error: request for member ‘a’ in ‘e’, which is of pointer type ‘stEstructura*’ (maybe you meant to use ‘->’ ?)
    cout << *e.a << endl;
               ^
stdout
Standard output is empty