Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <conio.h>
- #include <ctime>
- int* returningPointer(int nil)
- {
- srand(time(NULL));
- int* x = new int(rand()%20);
- return x;
- }
- int main()
- {
- int** foo = new int*();
- for(int i = 0; i <= 8; ++i)
- {
- foo[i] = (int*)&returningPointer;
- int* b = returningPointer(NULL);
- foo[--i] = b + i;
- }
- for(int i = 0; i <= 8; ++i)
- std::cout << "Value: " << (int*)foo[i] << std::endl;
- memset(NULL,0x00,NULL);
- return 0;
- }
Add Comment
Please, Sign In to add comment