Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storage classes and variable passing 1

Status
Not open for further replies.

Disruptive

Programmer
Mar 8, 2005
40
GB
void mycreatedynamicstorage(int **MyArray)
{


by malloc -allocate some 2D storage for the variable above.


}

void populatestorage(int **MyArray)
{

Simply populate the sample.


}

int main(void)
{

int **MyArray;
mycreatedynamicstorage(MyArray);
populatestorage(MyArray);


}


My question comesdown to storage class. I have following set-up. The create routine works as it should and creates an array,

but when it is sent to the next function it seems that I get a segmentaion fault and it would appear the array has gone

missing. Should I use a storage class for this. Now these routines are tested and work if I dont not explicity call the arrays

in the function and place the int **MyArray out of the main and into global. Please help if you can, I would send the code, but

I amworking on Linux without a connection so have had to type in the salient points. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top