100
Compiler
© 2008 Conrad Electronic
if(a==
2
) b++;
if(x==y) a=a+
2
;
else a=a-
2
;
An
can be defined instead of a single instruction.
Examples:
if(x<y)
{
c++;
if(c==
10
) c=
0
;
}
else d--;
if(x>y)
{
a=b*
5
;
b--;
}
else
{
a=b*
4
;
y++;
}
5.2.6.6
switch
If depending on the value of an expression various commands should be executed a switch
instruction is an elegant solution:
switch( Expression )
{
case constant_1:
Instruction_1;
break;
case constant_2:
Instruction_2;
break;
.
.
case constant_n:
Instruction_n;
break;
default:
// default is optional
Instruction_0;
};
The value of the Expression is calculated. Then the program execution will jump to the constant
Summary of Contents for C-Control Pro Mega Series
Page 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Page 9: ...VIII Inhalt 2008 Conrad Electronic ...
Page 10: ...Part 1 ...
Page 17: ...Part 2 ...
Page 23: ...Part 3 ...
Page 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Page 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Page 58: ...Part 4 ...
Page 91: ...82 IDE 2008 Conrad Electronic ...
Page 92: ...Part 5 ...
Page 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Page 136: ...Part 6 ...
Page 231: ...Part 7 ...
Page 240: ......