Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //this function returns the array location
- int &SetValue(int loc){
- int Arr[] = {0};
- return Arr[loc];
- }
- void SetValue(int loc, int val){
- int Arr[] = { 0 };
- Arr[loc] = val;
- }
- int main(){
- int *x = 0;
- int y = 0;
- SetValue(9, 3);
- x = &SetValue(9);
- cout<< x <<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement