fork download
  1.  
  2. #include <cstdlib>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. double* funct()
  8. {
  9. double mat[5]={3,6,8,12,13};
  10.  
  11. cout << "in funct:" << endl;
  12.  
  13. for (int i=0; i<5 ; i++)
  14. cout << mat+i << " ";
  15.  
  16. cout << endl;
  17.  
  18. for (int i=0; i<5 ; i++)
  19. cout << *(mat+i) << " ";
  20.  
  21. return mat;
  22. }
  23.  
  24.  
  25.  
  26. int main()
  27. {
  28. double* mat_main;
  29.  
  30. mat_main = funct();
  31.  
  32. cout << endl << "in main:" << endl;
  33. for (int i=0; i<5 ; i++)
  34. cout << mat_main+i << " ";
  35.  
  36. cout << endl;
  37.  
  38. for (int i=0; i<5 ; i++)
  39. cout << *(mat_main+i) << " ";
  40.  
  41. system("pause");
  42. return 0;
  43. }
  44.  
  45.  
Success #stdin #stdout #stderr 0s 2852KB
stdin
Standard input is empty
stdout
in funct:
0xbf8fa748 0xbf8fa750 0xbf8fa758 0xbf8fa760 0xbf8fa768 
3 6 8 12 13 
in main:
0xbf8fa748 0xbf8fa750 0xbf8fa758 0xbf8fa760 0xbf8fa768 
-2.07167e-41 -2.07167e-41 4.86669e-270 2.12864e-313 8.48798e-314 
stderr
sh: pause: not found