http://pastebin.com/uG54nJsv

trying to make a linked list and C and for some reason it keeps crashing...the program is compileable if you'd like to see the memory error. I think my problem is with my pointer and dynamic memory allocation. -thx

Recommended Answers

All 4 Replies

Well first things first...This is C++ and not C, just look at your for statements and your includes.

thanks....but anyone happen to know what i am doing wrong with my pointer? and dynamically allocated memory for the linked list?

You have to understand, we can't even imagine why you have conditions like so

while(!( (scanRet != EOF && scanRet != 0) && (ptr[i].ssContrib >= 0 && ptr[i].ssContrib <= 8000) ) );

You have comments explaining why your including this library or that one but no comments as to why you have these gargantuan conditionals...If you look at most code. you'll find that simplicity rules.

do
		{
		flushall();
		printf("\nEnter ID: ");
		scanRet = scanf("%d", ptr[i].idNum);
		}while(!(scanRet != EOF && scanRet != 0));

i can find where is crashing when a value gets assigned to ptridNum; but im not sure why tho...

And sorry for the huge conditional. I'm not sure how i could simplify this conditional to be honest

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.