fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct abc {
  5. int foo;
  6. };
  7.  
  8. typedef abc* abcp;
  9. typedef const abc* constAbcp ;
  10.  
  11.  
  12. int main() {
  13. abc temp[5];
  14.  
  15. const abcp a1 = temp;
  16. constAbcp a2 = temp;
  17.  
  18. a1->foo = 5; // OK
  19. //a2->foo = 5; // Bad(Compile error)
  20.  
  21. //a1++; // Bad
  22. a2++; // OK
  23. return 0;
  24. }
Success #stdin #stdout 0s 3292KB
stdin
Standard input is empty
stdout
Standard output is empty