|
Weird problem with if statements
When we were doing some programming today, i wrote a good length section of code, with a few if statements thrown in there, in some of the if statements i had if(blah = blah), well i spent a good period of time trying to figure out why the code wasn't working right, and it turns out it should have been if(blah == blah), im used to java and doing it that way, but when i compiled the first time in c with if(blah = blah) it worked fine, so i thought it was fine. there is no real problem here, i just thought to let some other people know who might be running into problems and don't know why, to check that they have ==, not =, also what does = mean in an if statement?
Hope this helps anyone that needed it, and thanks for answering what does = mean if it isn't the same as ==?
|