I’m still very new to C, have only been learning for about a week at this point, but something I don’t get is the use of pointers. I get how pointers work and I know how to use them, but I don’t see why or when they should be used. Can someone please explain this to me?
>Solution :
It is enough to mention that arrays used in expressions with very rare exceptions are implicitly converted to pointers to their first elements.
For example if you will write the expression
arr[i]
where arr is the array name then even in this expression the array is converted implicitly to a pointer to its first element.
Or another simple example: all C string functions deal with pointers of the type char * because passed arrays again are implicitly converted to pointers to their first elements.
Think about how to write a general sort function for arrays of any types.