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 :Code:typedef struct DataElement2 { char Sub[75]; int Pos; } Substituent;
main function call:Code:SP = new DataElement2 [ 75 ]; 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:
ev_num:Code:loop { ev_num(SP); }
When I print out SP at the end of my main function, itsCode: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.



LinkBack URL
About LinkBacks


