C Keywords Flashcards

(19 cards)

1
Q

static

A

Preserves a variable’s value between function calls. If used globally, it limits the variable’s scope to that specific file only

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

Volatile

A

Tells the compiler the variable can change unexpectedly (e.g., a hardware register or a value changed in an ISR). Prevents the compiler from optimizing it away.

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

Extern

A

Declares a variable or function that is defined in a different file, allowing it to be used across the whole project.

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

Const

A

Declares a variable as “read-only.” In embedded, this often ensures the data is stored in Flash (ROM) memory rather than RAM.

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

Register

A

A hint to the compiler to store the variable in a CPU register for faster access (rarely used in modern compilers but good to know).

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

Struct

A

Groups different types of variables together under one name (e.g., a “Sensor” struct with ID and Value).

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

Union

A

Similar to a struct, but all members share the same memory location. Used to save space or view the same data in different ways (like a float as 4 bytes).

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

typedef

A

Creates a nickname for a type (e.g., typedef unsigned char uint8_t;). Makes code much more readable.

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

enum

A

Defines a list of named integer constants (e.g., enum State {IDLE, RUNNING, ERROR}).

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

sizeOf

A

An operator that returns the size of a data type or variable in bytes.

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

break

A

Immediately exits the current loop or switch statement.

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

Continue

A

Skips the rest of the current loop iteration and moves to the next one.

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

Switch/Case/Default

A

A cleaner way to write multiple if-else statements based on a single integer value.

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

do / while

A

A loop that is guaranteed to run at least once before checking the condition.

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

goto

A

Jumps to a labeled part of the code (generally discouraged, but sometimes used in embedded for centralized error handling).

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

void

A

Means “nothing.” Used for functions that don’t return anything or for “generic” pointers (void *).

17
Q

unsigned

A

Means “nothing.” Used for functions that don’t return anything or for “generic” pointers (void *).

18
Q

signed

A

The default; allows for both positive and negative values.

19
Q

short / long

A

Modifiers to decrease or increase the memory size of an integer.