C Program Stalls or Infinite Loops inside and else statement?
- by Bobby S
I have this weird thing happening in my C program which has never happened to me before.
I am calling a void function with a single parameter, the function is very similar to this so you can get the jist:
...
printf("Before Call");
Dumb_Function(a);
printf("After Call");
...
...
void Dumb_Function(int a){
if(a == null)
{
}
else{
int i;
for(i=0; i<a; i++)
{
do stuff
}
printf("test");
}
}
This will output
Before Call
test
and NOT "After Call"
How is this possible? Why does my function not return? Did my program counter get lost? I can not modify it to a non void function.
When running the cursor will blink and I am able to type, I press CTRL+C to terminate.
Any ideas?