Hi,
I'm using visual studio 2005 on windows.
I'm creating a struct that I'm trying to pass between
functions. I set it up in a header file:
I initialize it in my main function :
I want to pass this to another function where it gets populated. The function's name is ev_num. This function
is called multiple times. Leaving other parts out for
simplicity:
main function call:
ev_num:
When I print out SP at the end of my main function, its
missing values that were found in the individual calls. Not
sure what I'm doing wrong, seems like SP gets erased each
time I call ev_num.
Any help would be greatly appreciated.
I'm using visual studio 2005 on windows.
I'm creating a struct that I'm trying to pass between
functions. I set it up in a header file:
Code:
typedef struct DataElement2 {
char Sub[75];
int Pos;
} Substituent;
I initialize it in my main function :
Code:
SP = new DataElement2 [ 75 ];
is called multiple times. Leaving other parts out for
simplicity:
main function call:
Code:
loop {
ev_num(SP);
}
Code:
int ev_num(Substituent *SP) {
// figured out SubPosCounter in some code above (leaving out - know its correct)
SP[SubPosCounter].Pos = t->p[branchid];
SubPosCounter++;
}
missing values that were found in the individual calls. Not
sure what I'm doing wrong, seems like SP gets erased each
time I call ev_num.
Any help would be greatly appreciated.