What is wrong with my for loop ? Segmentation fault

Greetings all.
After running my code, it stops when it comes to this part with the for loop. My for loop basically looks like this :

1
2
3
4
5
6
7
8
double CurrentTime = 0.0;
double Step = 60.0 ;
double EndTime = 300.0*60.0;


 for ( CurrentTime = 0.0; CurrentTime <= EndTime ; CurrentTime+=Step )
{
}


I left out what is inside the loop because I get same segmentation fault even if I comment everything inside the loop.
Where did I make the mistake ? Thank you.
Kind regards, T
doesn't crash for me.
are you sure an empty for loop would cause this?
The segfault probably happens after the loop.
yes. in code that hasn't been shown.

I put this in the for:
1
2
std::cout << "Time: " << CurrentTime << std::endl;
		


and it's printing out just fine.
@mutexe - yes, I commented out everything so it looks like in my post now
@Peter87 - after the loop there is only "return 0" and "}" for end of main
OP i dont think you're getting me... I do NOT get a crash at all. That loop is fine.
There is something you're not showing us.
Last edited on
Yes, I understand you are not getting a crash, but I am :D
By the way I am using CodeBlocks on Win 7. And yesterday I've had problems with mkdir that I didn't see before, so maybe my configuration got messed up.
Last edited on
are you sure it's getting to the loop?

Put
 
std::cout << "**BEFORE LOOP**" << std::endl;


on your line 5 and run again.

is that line output to the screen?
Last edited on
Thank you for suggestion. If I comment out the entire for loop, it gets to printing **BEFORE LOOP**. But if I leave the for loop there, it doesn't get to printing **BEFORE LOOP** - program crashes again.
Last edited on
Topic archived. No new replies allowed.