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)
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.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
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 )
Devoted my life to programming...
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;
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
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.
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
yep, brewbuck is right, int m; gives an unpredictable number. E.G it may contain
10 by default and 49 on another computer.