ESP - Week 5 Flashcards

1
Q

Find how much memory a variable takes

A

sizeof(datatype)

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

Avoiding global scope

A

Pass variables with parameters

Use return

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

What is *p

A

The value of a variable called p

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

How to default a pointer

A

Make it = NULL

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

How to find the address of a variable

A

Use &

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

What does malloc do

A

Reserve the amount of memory needed for a data type

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

Malloc cast

A

a = (b *)malloc

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

How to free up used memory

A

free(variable_name)

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

SRAM divisions

A

Static data: global and static variables
Heap: dynamic variables (malloc)
Stack: function calls

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

Why should recursion be avoided

A

It can take up memory and cause crashes

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

Why use char instead of string

A

String tends to use malloc and free which can cause heap fragmentation

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

What is heap fragmentation

A

When a pointer is lost and memory cannot be freed

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

How to put a variable in the flash memory

A

F()

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

How to use eeprom

A

EEPROM.read

EEPROM.write

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

Why is eeprom update better than write

A

It will only use memory if the value is different to in the address

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