Hi,
It appears my program can't get past a particular printf() statement.
Code excerpt:
[...]
printf("Sales Report\n--------------");
printf("Testing code - pre loop entry");
while(category != null)
{
printf("Testing code - in-loop");
[...]
(Ignore the category thing, that's just the start of a linkedlist search) The program is written so that at the end of a function, it'll return to main (which will reprint a menu for next selection). However, when I run this option, all i get is:
Sales Report
------------------
and then it hangs - no segfault, it just sits there, like there's an infinite loop. But given it doesn't even print the 'pre loop test', I can't see how it could BE in an infinite loop - it hasn't even gotten to the loop yet. It's stuck between printf() statements.
Furthermore, if I replace the "printf("Testin g code - pre loop entry"); with just a 'return;', the funtion returns to the menu after printing the first printf() statement. So it can access a 'return;' statement fine, but it can't read anything else after that first printf().
I have this written pretty much identically in another function, where it has to print out stock quantities rather than sales, and that works perfectly. I can't find any indication in my reference manuals as to what's causing this, and GDB simply tells me there's a segfault in " ?? () ". I'm really at a loss as to diagnose this - help?
It appears my program can't get past a particular printf() statement.
Code excerpt:
[...]
printf("Sales Report\n--------------");
printf("Testing code - pre loop entry");
while(category != null)
{
printf("Testing code - in-loop");
[...]
(Ignore the category thing, that's just the start of a linkedlist search) The program is written so that at the end of a function, it'll return to main (which will reprint a menu for next selection). However, when I run this option, all i get is:
Sales Report
------------------
and then it hangs - no segfault, it just sits there, like there's an infinite loop. But given it doesn't even print the 'pre loop test', I can't see how it could BE in an infinite loop - it hasn't even gotten to the loop yet. It's stuck between printf() statements.
Furthermore, if I replace the "printf("Testin g code - pre loop entry"); with just a 'return;', the funtion returns to the menu after printing the first printf() statement. So it can access a 'return;' statement fine, but it can't read anything else after that first printf().
I have this written pretty much identically in another function, where it has to print out stock quantities rather than sales, and that works perfectly. I can't find any indication in my reference manuals as to what's causing this, and GDB simply tells me there's a segfault in " ?? () ". I'm really at a loss as to diagnose this - help?
Comment