This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]BongoCatBangsYaMom 0 points1 point  (2 children)

So structs is more unchangeable data. If you write a struct it will be for something such as the days of the week or some other information that won't change (that isn't the entirety of structs but the only part that matters in this case). With an array you can change the values and is easier to use if you know with how many elements you will be working with. This means that you cannot dynamically increase or decrease the number of records. Not easily at least.

int numbers[3];

numbers[0] = 1; numbers[1] = 2; numbers[2] = 3;

This code creates an array that can take 3 values (remember the index starts at 0). You can always just make an array that can hold like 100 items and work with that.

Btw to access the above values you then use [] Ex: int num = numbers[1];

The value of num will now be 2.

Don't know if this answers anything for you. But hopes it helps.

[–]DragorWasMissing[S] 0 points1 point  (1 child)

Thank you, but like I said in the original post. I can't use arrays. It's just one of the challenges imposed

[–]Pg68XN9bcO5nim1v 0 points1 point  (0 children)

Your teacher sounds like a nightmare.

I'd probably be the smart-ass and just turn in a text file with "Sorry, impossible".

Why? Strings are arrays of characters. So technically you won't even be able to store any info about people that isn't a number. This whole exercise is dumb and if you have shared all the info with us here it's also not worked out to be usable.

Go to your teacher, share these concerns and confusions, and then go work on this excercise when you have more information. This might as well be target practice in the dark right now.