I am having this problem with these for loops. Whenever I add "ydisplacement2" to the loop, some results become gibrish. ydisplacement2 will eventually change value through a different loop. These are the loops:
1 2 3 4 5 6 7 8
float ydisplacement2 = 0.0, n, n1
for (n = 3 + ydisplacement2; n <= 70; n = n + 5)
{ for (n1 = 4.0 ; n1 <= 39; n1 = n1 + 5) {
}}
float ydisplacement2 = 0.0, n, n1 //need a semicolon ;
for (n = 3 + ydisplacement2; n <= 70; n = n + 5) {
// can be n += 5 but whatever
for (n1 = 4.0 ; n1 <= 39; n1 = n1 + 5) {
// n1 += 5
//... more code here I assume?
}
}
If your not careful you can get weird floating point precision errors. If you only want int's you should use int. However I doubt that's where the problem is. Your for-loops look fine.