fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void func()
  5. {
  6. const char *tmp="Ala ma kota";
  7. cout<<"func(): "<<(void*)tmp<<endl;
  8. }
  9.  
  10.  
  11. int main()
  12. {
  13. func();
  14. const char *msg="Ala ma kota";
  15. cout<<"main(): "<<(void*)msg<<endl; // adres jest ten sam, czyli takie same stałe ładowane w jednym miejscu.
  16. msg="Ewa ma psa";
  17. cout<<"main(): "<<(void*)msg<<endl;
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
func(): 0x55a4ee15400d
main(): 0x55a4ee15400d
main(): 0x55a4ee154022