I just learned pointers in my computer science class and i am having a hard time understanding what they are used for. Are they absolutely necessary to use them when passing arrays from functions ect. or is it just a more efficient way of doing so?

>Are they absolutely necessary to use them when passing arrays from functions ect. or is it just a more efficient way of doing so?
It is the only way you can pass by reference.
Further ahead in you education you'll learn that pointers shine when they are used in conjunction with allocation of dynamic memory and pointer to function.

I just learned pointers in my computer science class and i am having a hard time understanding what they are used for. Are they absolutely necessary to use them when passing arrays from functions ect. or is it just a more efficient way of doing so?

Don't look at the problem in hand,try to see through it ok.

Pointers are nothing but what they literally mean. They just point to things(Here variables arrays etc).
Here in C when we work we have this kind of layout:

Name
Memory
Address

Every memory block we use has an address( got by using &variable ) and we give it a name ( the variable name we use most of the time ).
We can easily pass these kind of (single unit) types to functions as arguments easily.But when it comes to an array it is not a single unit as such. It is a unit formed of similar units taken together and just think how difficult it would be to pass each unit of the array to function as array[0],array[1] ( If its a large number as array[1000] or something we are doomed :D )
So in case of arrays what we do is we send something which points to the memory unit where the array starts and access it.

Once you dive to the depths of "C" you wont find a topic more beautiful than pointers.Just keep your chill and learn what has been taught to you perfectly. :)

This article has been dead for over six months. Start a new discussion instead.