Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <vector>
- using namespace std;
- std::vector<short> randVect()
- {
- std::vector<short> rV(0);
- for(int i=0; i<100; i++)
- {
- rV.push_back(rand());
- }
- return rV;
- }
- int someCondition=1;
- short* test()
- {
- std::vector<short> tV(0);
- std::vector<short> tV2=randVect();
- if(someCondition==1){
- short *tmp=new short[2];
- cout << "test() says : " << tmp << endl;
- return tmp;
- }else if(someCondition==2){
- short *tmp=new short[4];
- cout << "test() says : " << tmp << endl;
- return tmp;
- }
- }
- int main()
- {
- cout << "Hello world!" << endl;
- cout << "main() says : " << test() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment