Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
It really depends on the variable. If it's a float or a signed integer then it's by all means the right way
-
shaki3536yDepends if you want to do something when variable1 is just not 0 i.e after the second if
-
for that particular case it makes no sense, but if that var is nullable then checking if not null then doing some code.
Or in this case where its an integer, maybe a block of code to be executed regardless of value we have and which "if" gets executed.
Again, without more info that as is, is not reasonable to write -
kamen69256yAsk for a "why". What might seem strange might have a perfectly reasonable explanation.
-
I don't get all the teacher bashing you find on here. Most teachers are not stupid. It's often just a miscommunication or something the student is wrong about.
-
@jOkEr-jAsE Of course but their was nothing inside the if with ! = 0
I did the same program only using > 1... -
For all that are telling that i'm wrong, well the teacher didn't used the condition with != 0 but only > 1
void Binary(int decimal) {
int val1 = decimal/2;
int val2 = decimal%2;
if (val1 != 0) {
if (val1 > 1) {
Binary(val1);
}
}
printf("%d", val2);
}
Sorry but this is stupid. -
@kamen The teacher doesn't understand me about this and i do not undestand why he does this
Related Rants
My teacher tell me to do this..
So dumb right ?
joke/meme
what dumb
if
less
greater than
lol
dumb
laugh
teacher
ahah
code
stupid