First page Back Continue Last page Graphics
== vs =
Don't forget, == is “equality”
= is “assignment”
A subtle mistake:
- If ( a = 12 ) { do something } ;
- Since a = 12 is an assignment, it always has the value 12. The value 12 is not 0 so it takes the true branch always!
- Practice: equal.cpp in prata
strcmp ( ) for c-string comparisons.