I have got my allocateMemory function working using the pointer to a pointer method. However I am having trouble with the reallocate function. I have posted my current code and highlighted the areas which i belive to be incorret (ptrDatabase on the 1st red line and &ptrNew on the 2nd red line.Code:int ReallocateMemory(RECORD ** ptrDatabase, int * currentMemSize) { RECORD * ptrNew; ptrNew = (RECORD *) realloc(ptrDatabase, (*currentMemSize + memIncrease) * sizeof(RECORD)); if (ptrNew == NULL){ return 0; } else{ ptrDatabase = &ptrNew; *currentMemSize += memIncrease; return 1; } }
Thanks chris



LinkBack URL
About LinkBacks



