C Tutorial/Data Type/Equality — различия между версиями
Admin (обсуждение | вклад) м (1 версия: Импорт контента...) |
Admin (обсуждение | вклад) м (1 версия: Импорт контента...) |
(нет различий)
|
Текущая версия на 13:32, 25 мая 2010
Comparing the equality operator (==) with the "=" assignment operator.
a b a = b a == b 5 3 a = 3 (true) false 7 0 a = 0 (false) false 0 0 a = 0 (false) true
To test two expressions for equality, use == instead of =
<source lang="cpp">#include <stdio.h> main(){
int i = 5; if(i == 5){ printf(" ==. \n"); } if(i=4){ printf("do not use = "); }
}</source>
==. do not use =