113
Chapter 8: C Programming
3. This program simply does not do what it should:
int x;
main()
{
x=input(5);
if (x=10)
{
output(9,1);
}
else
{
output(9,0);
}
}
The problem is that the statement: if (x=10) actually assigns the value of 10 to x. The key is
that it uses a single equals sign ‘=’. To test a condition, use the double equals sign, ‘==’. See
below:
int x;
main()
{
x=input(5);
if (x==10)
/* Notice the == */
{
output(9,1);
}
else
{
output(9,0);
}
}
Summary of Contents for Sensaphone ISACC
Page 1: ...Sensaphone ISACC Operator s Manual version 3 49...
Page 22: ...22 Sensaphone ISACC Instruction Manual...
Page 52: ...52 Sensaphone ISACC Instruction Manual...
Page 76: ...76 Sensaphone ISACC Instruction Manual...
Page 114: ...114 Sensaphone ISACC Instruction Manual...
Page 120: ...120 Sensaphone ISACC Instruction Manual...
Page 124: ...124 Sensaphone ISACC Instruction Manual...
Page 130: ...130 Sensaphone ISACC Instruction Manual...
Page 132: ...132 Sensaphone ISACC Instruction Manual...
Page 140: ...140 Sensaphone ISACC Instruction Manual...