-
Why do I need arrays?
So I'm starting to learn C (again again, hopefully I don't quit this time), and I can't understand the use of arrays.
Don't get me wrong, I know how to use an array. I just don't understand why I would want to.
Does it have any advantages over just creating a bunch of variables, other than better organised code?
-
Yes, it has a huge advantage in that you can properly access the elements of the array by index or through a pointer, hence allowing you to do things like loop over them. You cannot normally do that when you have a bunch of separate variables.