Assignment in test: OK?
John Gordon
gordon at osiris.cso.uiuc.edu
Fri Sep 7 14:27:59 AEST 1990
One way to avoid the =/== pitfall is to write your code like this:
if(7 == x) rather than if(x == 7).
If you write it the first way, and accidentally write = instead of ==,
you will be trying to assign a value to a constant (!!) and will get
an error.
---
John Gordon
Internet: gordon at osiris.cso.uiuc.edu #include <disclaimer.h>
gordon at cerl.cecer.army.mil #include <clever_saying.h>
GEnie: j.gordon14
More information about the Comp.lang.c
mailing list