forked from isi-nlp/LSTM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
35 lines (32 loc) · 849 Bytes
/
test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
using namespace std;
struct blah {
int a;
};
void createStruct(blah ***blah_array) {
//blah ** createStruct() {
//blah ** blah_array;
blah ** temp;
temp = new blah* [10];
*blah_array = temp;
cout<<"blah array in function "<<*blah_array<<endl;
for (int i=0;i<10;i++) {
(*blah_array)[i] = new blah;
cout<<"created "<<i<<endl;
(*blah_array)[i]->a = 5;
}
//return blah_array;
}
int main(int argc, char** argv){
blah** blah_array;
cout<<"before the function blah array is "<<blah_array<<endl;
//blah_array = new blah*[10];
createStruct(&blah_array);
cout<<"blah array is "<<blah_array<<endl;
//blah_array = createStruct();
for (int i=0;i<10;i++){
cout<<"printing"<<endl;
cout<<i<<":"<<blah_array[i]->a<<endl;
//cout<<i<<":"<<(*(blah_array + sizeof(blah*)*i))->a<<endl;
}
}