Syntax Structures Flashcards

1
Q

An if-statement is your basic logic branching control

A
i f (TEST) {
CODE;
} e l s e i f (TEST) {
CODE;
} e l s e {
CODE;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A switch-statement is like an if-statement but works on simple integer constants

A
s w i t c h (OPERAND) {
c a s e CONSTANT:
CODE;
break ;
d e f a u l t :
CODE;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A while-loop is your most basic loop

A

w h i l e (TEST) {
CODE;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

You can also use continue to cause it to loop. Call this form while-continue-loop for now

A
w h i l e (TEST) {
i f (OTHER_TEST) {
c o n t i n u e ;
} CODE;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

You can also use break to exit a loop. Call this form while-break-loop

A
w h i l e (TEST) {
i f (OTHER_TEST) {
break ;
} CODE;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The do-while-loop is an inverted version of a while-loop that runs the code then tests to see
if it should run again

A

do {
CODE;
} w h i l e (TEST ) ;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The for-loop does a controlled counted loop through a (hopefully) fixed number of iterations
using a counter

A

f o r ( INIT ; TEST ; POST) {
CODE;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

An enum creates a set of integer constants

A

enum { CONST1, CONST2, CONST3 } NAME;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A goto will jumpt to a label, and is only used in a few useful situations like error detection and
exiting

A
i f (ERROR_TEST) {
goto f a i l ;
}
f a i l :
CODE;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A function is defined this way

A

TYPE NAME(ARG1, ARG2, . . ) {
CODE;
r e t u r n VALUE;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A typedef defines a new type

A

t y p e d e f DEFINITION IDENTIFIER ;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

(A typedef defines a new type) A more concrete form of this is

A

t y p e d e f unsigned char byte ;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly