Hey guys,
I have a question about int's in C. How would I write code to figure out whether an int contains the number zero. Thanks for the help!
Integer containing 0 in C.?
i would make it in to a char array then search the char array for '0' im not to familuar with c but it is how i would do it in c#
to the person below that is to check it the int is 0 not if it contains a 0 such as 103 contains a 0 but that code wouldnt detect it
Reply:i understand that you need to check if a integer is 0 or not.
try using this:
int a;
if(a==0){
//if a contains 0 do something here
}
else{
//if its not 0 do something else
}
Reply:int k=0;
if (k==0) {
do this code if k = 0
} else {
do this code if k ≠
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment