Advertisement

member variables in for loops

Started by September 07, 2000 04:13 PM
6 comments, last by JwayneT 24 years, 3 months ago
Okay,

I have a method in my playerclass to draw a sprite, now I set it up to be able to take any bitmap asigned to it. But I'm having on problem. In the for loops which I use to draw the bitmap, I have a member variable to designate the width. When I just put in a number like

for(i=0;i<10;1++);

My routine runs just fine. When I try to use my member variable (it is a part of a struct I wrote called D2Dvector)

for(i=0;i< main.mag;i++);

it emediantly boots out of my program. I have initialized the variable, I have checked this a thousand times. And I am running out of Ideas. <style>a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Snootchie Bootchies!

-=CF=-</html> Edited by - JwayneT on 9/7/00 4:16:20 PM
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Why is it called a hot water heater? Isn't it cold when it goes in the tank?

[email=jtaylor@gtemail.net" class="h]-=CF=-[/email]
Make sure that main.mag isn''t changed in the for loop.
And you shouldn''t write a semicolon after the for instruction

GA
Visit our homepage: www.rarebyte.de.stGA
Advertisement
I put the semi-colon there just for compleatness, don''t ask.

But as far as it changing, I leave it static while the loop runs.

a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Snootchie Bootchies!

-=CF=-
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Why is it called a hot water heater? Isn't it cold when it goes in the tank?

[email=jtaylor@gtemail.net" class="h]-=CF=-[/email]
Check to see if main==NULL
main isn''t a pointer, or at least shouldn''t be.

a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Snootchie Bootchies!

-=CF=-
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Why is it called a hot water heater? Isn't it cold when it goes in the tank?

[email=jtaylor@gtemail.net" class="h]-=CF=-[/email]


Not sure what you mean by putting a '';'' there "for completness"?

If you have a for loop, and then place a semi colon after the construct like that the '';'' is effectively the body of your loop.

e.g.

    for(int i=0; i < UPPER_BOUND; i++) ;{//: this doesn''t execute in loop//: because of semi-colon}    


Advertisement
I think he meant for completeness in this posting, without taking all of the code. He was just making correct syntax, even though not useful (usually). Or so I assume.
That''s exactly what I ment Null and Void.

a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Snootchie Bootchies!

-=CF=-
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Why is it called a hot water heater? Isn't it cold when it goes in the tank?

[email=jtaylor@gtemail.net" class="h]-=CF=-[/email]

This topic is closed to new replies.

Advertisement