Structs Flashcards

1
Q

What is needed for making a class task?

A

We need a default constructor, copy constructor, = operator :

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

What do i need to be careful of when solving structures?

A

When making a function to find some min, max to make sure that that the indexes of the array are set properly e.g.:
if i have an array that i want to access from a different structure through the parameter struct that i have in my function i should call inside the loop the second loop ā€œjā€ which accesses the elements of the second struct that im accessing from the initial parameter struct:

for (int i = 0; i < size; ++i) {
for (int j = 0; j < s[i].n; ++j) {
if (s[i].available[j].touch == 1) {
touchScreen = true;
if (s[i].available[j].price < min) {
min = s[i].available[j].price;
index = i;
}
}
}
}

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