fork download
  1. #include <iostream>
  2.  
  3. void printIntByRef(const int & value) {
  4. std::cout << value << std::endl;
  5. }
  6.  
  7. void printInt(const int value) {
  8. std::cout << value << std::endl;
  9. }
  10.  
  11. int main(){
  12. const int a = 5;
  13. int * pca = (int *)(&a);
  14. *pca = 4;
  15.  
  16. std::cout << &a << std::endl;
  17. std::cout << pca << std::endl;
  18.  
  19. printInt(a);
  20. printIntByRef(a);
  21. }
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
0xbfc491cc
0xbfc491cc
5
4