Pointer Variables

Pointers are a very useful part of efficient C programming. They are variables that store the memory address of other variables.

Pointer variables are declared in just the same way that other variables are declared but the variable name is prefixed by a *. It represents the `dereference operator`, and merely denotes that the declared variable is a pointer. The pointer`s data type must match the data type of the variable it points to.

Once declared, a pointer variable can be assigned the address of another variable using the & address of operator. The variable name should not be prefixed by the * dereference operator in the assignment statement unless the pointer is initialized immediately in the variable declaration itself.

A pointer variable name, when used alone, references a memory address expresses in hexadecimal.

When the * dereference operator is used in a variable declaration it merely indicates that the variable being declared is a pointer. However, when a * dereference operator appears before a pointer variable elsewhere in a program it references the data stored at the address assigned to that pointer. A pointer variable name, when prefixed by the *dereference operator, references the data stored at the address assigned to that pointer.

A program can get the address assigned to a pointer variable just by using its name, or it can get the data stored at that address by prefixing its name with the *dereference operator. The * dereference operator is alternatively known as the indirection operator. Once a pointer variable has been created with an assigned address it can be reassigned another address or moved using arithmetic. The ++ increment operator and the -- decrement operator will move the pointer along the next or previous address for that data type – the larger the data type, the bigger the jump. Larger jumps can be achieved using the += and -= operators.

Pointer arithmetic is especially useful with arrays because the elements in an array occupy consecutive memory places. Assigning just the name of an array to a pointer automatically assigns it the address of the first element. Incrementing the pointer by one moves the pointer along to the next element. A loop can increment the pointer to each element. The name of an array acts like a pointer to its first element.

Quick Note: Taking the Nonsense out of looking for the right spyware remover

If you really want to take the work out of looking for that right Spyware Protection from a Spybot go to the Internet and get a Free Spybot or a Free Spybot Search and Destroy
Download, In order to prevent your vital information from being ripped from your computer get your Spybot Remover Today.

Pointers are particularly useful to reference the data at a particular location indicated by the pointer.

About the Author:

You really want to take the work out of looking for Protection from a lurking theif then you should get your free Spybot to protect you. Go to the Internet and get The New Free Spybot Download or just Spybot
to prevent your vital information from being taken from you and given to someone who will steal your money or something else that you treasure so dearly.

Article Source: ArticlesBase.com - Pointer Variables

Spybot, Free Spybot Download, Spybot Search And Destroy, Free Spybot, Spybot Download, Spybot Search And Destroy Downloads