Node:Important note about assignment, Previous:The assignment operator, Up:The assignment operator



Important note about assignment

Many people confuse the assignment operator (=) with the equality operator (==), and this is a major source of bugs in C programs. Because of early arithmetic training, people tend to think of = as indicating equality, but in C it means "takes on the value produced by", and it should always be read that way. By way of contrast, == is an equality test operator and should always be read "is tested for equality with". (See Comparisons and logic, for more information on the == operator.)