0
How to make an array of structs
the programme is to declare a structure named studentthat carry 5 variables then make an array which consists of ten structures and sort them according to one of the variables I tried this student A [10]; but it didn't work I tried to do it by dynamic memory but don't know how to sort them
1 Resposta
+ 4
You need to provide the structure, so that anyone trying to help you may understand the matter and solve it.
Perhaps its some constructor or incorrect declaration?
What type of errors do you get when you type student A[10]; ? Perhaps some earlier variable named A exist?
Please provide some more details, if possible, and then people will be able to help.
And arrays declared dynamically work in the same way as usual ones (in fact, they are just analogous). Thus you may use the operator[] anytime with a dynamic array like you did with a normal one, and use the same loops.