Using Pointers in C

Almost every real-world C program uses pointers in some way or another. Much of the usefulness of pointers stems from the fact that in C all function arguments are passed by value. Because a function only receives local copies of such arguments, it can't change the original values that the arguments represent. Pointers make this possible.

Here are some common uses of pointers:

Manipulating strings

Passing command-line arguments to a program at run time

Returning more than one value from a function

Accessing variables that wouldn't otherwise be visible to a function

Manipulating an array by moving pointers to its elements instead of using array subscripting

Accessing the address of a memory area that your program allocates at run time

Passing the address of one function to another function