my program is looping because
int m = (any integer)
stops it from pausing because a condition is being satisfied.
How do I clear m so that
m = (nothing)
Printable View
my program is looping because
int m = (any integer)
stops it from pausing because a condition is being satisfied.
How do I clear m so that
m = (nothing)
So you have a value that consists of 32 bits (I'm going to assume 32 bits anyway) which are either one or zero and you want it to equal "nothing"?
Well you'll just have to invent some combination of 32 ones and zeros that you'd like to mean "nothing" and assign that. Well you could set all 32 bits to zero I guess, in other words assign the value zero to m.
Perhaps you can just assign a value that stops the condition from being satisfied.
Actually, zero is (nothing), so it's safe and meaningful to set m to zero and do what i told you ( some times i guess :) )
You could also use an int pointer, and than can be set to NULL, which is not the same as having the pointer contain 0.
Code:int n = 0, *x = &n;
x = NULL;
So does that mean that when I create
int m;
its value is 0 anyway?
You could also create a class that represents an int, but also lets you set the state of the class to 'nothing'. Personally, I think that's overkill. Just use 0, or a NULL pointer.
yep, brewbuck is right, int m; gives an unpredictable number. E.G it may contain
10 by default and 49 on another computer.