Advertisement
TheWhiteFang

Brain = NULL

Jan 24th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. //this function returns the array location
  6. int &SetValue(int loc){
  7.  
  8.     int Arr[] = {0};
  9.     return Arr[loc];
  10. }
  11.  
  12. void SetValue(int loc, int val){
  13.  
  14.     int Arr[] = { 0 };
  15.     Arr[loc] = val;
  16.  
  17. }
  18.  
  19. int main(){
  20.  
  21.     int *x = 0;
  22.     int y = 0;
  23.  
  24.     SetValue(9, 3);
  25.     x = &SetValue(9);
  26.     cout<< x <<endl;
  27.  
  28.    
  29.  
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement