-
Clearing.
Hey all,
Just a simple question. How do you cleasr variables from a program. Such as I am writing a Craps program in c.. and yes this is a class assignment.. and i have it working but at one part it will start running the same number over and over.. i have looked at my loops and if statments and i see nothingwrong there. so what i am wanting to know is after each "roll" is there a command that will allow you to clear that value out.
Thanks for any assistance.
-
I'm not sure, but is it the same question I have?
Can you have a look to my last one/two threads?
I think you've figured out more than I have yet.
-
You mean how do you reset a variable so that the next iteration of the loop doesn't use the current value? try this:
Code:
baz = 0;
for(i = 0; i < FOO; i++){
for(j = 0; j < BAR; j++){
/*Do stuff*/
baz++;
}
baz = 0;
}
With that code you use the variable baz in the inner loop, and then when you exit the inner loop baz is set to 0 so that it the inner loop can start over with a fresh value.
This was my interperetation of your question, if I'm off let me know.
-
thanks guys. This was what i was looking for i appreciate the advice...
until next time
:p