Guest User

Untitled

a guest
Oct 11th, 2013
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. std::vector<short> randVect()
  8. {
  9.     std::vector<short> rV(0);
  10.     for(int i=0; i<100; i++)
  11.     {
  12.         rV.push_back(rand());
  13.     }
  14.     return rV;
  15. }
  16.  
  17. int someCondition=1;
  18.  
  19.  
  20. short* test()
  21. {
  22.     std::vector<short> tV(0);
  23.     std::vector<short> tV2=randVect();
  24.     if(someCondition==1){
  25.         short *tmp=new short[2];
  26.         cout << "test() says : " << tmp << endl;
  27.         return tmp;
  28.     }else if(someCondition==2){
  29.         short *tmp=new short[4];
  30.         cout << "test() says : " << tmp << endl;
  31.         return tmp;
  32.     }
  33. }
  34.  
  35. int main()
  36. {
  37.     cout << "Hello world!" << endl;
  38.     cout << "main() says : " << test() << endl;
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment