Oh wow you're right. When France comes up twice it just leaves that extra node. Thanks for your help again tabstop. I really appreciate it.
Type: Posts; User: RaDeuX
Oh wow you're right. When France comes up twice it just leaves that extra node. Thanks for your help again tabstop. I really appreciate it.
Oh, I was a bit confused with what you said.
Part of the issue was that I didn't give processListManager a return variable in main. Fixing it to
list = processListManager(list); so that's that....
I commented out the free ( ...name) and free ( ...capital), but I'm still getting a memory leak error.
So my program is 99% towards completion. However, the program leaks memory. The deleteNode, deleteManager, and destroyList are the ones to blame, or so I think. When I delete a node other than the...
Exactly my thought. However, when I use this approach for some reason my new node does not come up at all.
EDIT: Nevermind, for some reason it works fine now. Perhaps it's because I didn't give...
Alright, so I basically have three options in the function insertManager. I can put the new node in the beginning, middle, or end. I was able to put it in the end without any problems, but when I try...
Found it. I completely forgot that stacks and heap are different. I removed the following code and made the appropriate changes.
tempInt = createDynAry ( *numCountries );
tempName =...
Well it's under the assumption that the user correctly defines what they want. But anyway...
It's just that structures makes it a little different. I'm okay with pointers but I'm not godlike at it.
As long as I free the memory in a while loop 'til it hits NULL then I wouldn't need numCountries right? I'm not sure if releaseMemory is freeing the first level dynamically allocated pointers or the...
Okay, I fixed releaseMemory to be more NULL friendly.
void releaseMemory ( COUNTRY *list )
{
// Local Declarations
int i;
// Statements
i = 0;
I just put in 21 to see whether or not I freed the memory correctly. 21 is numCountries -1. The list's variables carry pointers to tempInt, tempName, tempCap, and tempPop. I also don't like using...
Country List Menu
L - list the countries in ID sequence
P - list the countries by population in descending order
S - Search by ID
C - Search by capital
Q - Quit the program
Please enter an...
I'm not sure how I'm freeing the memory incorrectly. I freed all the memory in each string until null, but it won't let me free the next level of pointers.....
...
I didn't know '/n' counted as a character as well, which was part of the reason why I didn't have that extra character space. Thanks for your input, there are no more memory leaks now.
Here's the updated version:
#include <stdio.h>
#include <stdlib.h>
#include <crtdbg.h>
#define FILE_IN "countries.txt" // user is free to change filename
// Prototype Declarations
char...
That causes the same debug error. It tells me that its detected a heap corruption.
No I don't. i is 13 after the for loop ends.
That's not the point. The 13 is temporary. What I'm trying to fix is the memory leak, not the functionality of the program.
The last country is a null pointer. Our teacher wants us to put a null pointer at the end of any array of pointers. I just put the numbers there assuming that the parameters would pass the value of...
My compiler gives me a heap stack error when I run that.
For some reason I'm getting a memory leak error. It's probably from the part where I start to copy the strings and allocate an array of characters, but I have no idea why. I'm using a text file for...