What is the pointer variable?

November 21, 2010 at 05:52:34
Specs: Windows XP
What is the pointer variable?

See More: What is the pointer variable?

Report •

November 21, 2010 at 08:15:22
A variable that points to another variable.

How To Ask Questions The Smart Way

Report •

November 21, 2010 at 21:32:15
ya its a variable that points to another variable, thats mean the pointer variable stores an address for another variable : For Example

you have (int variable) ------| int num = 5;
and (variable pointer) to int ------| int* ptr;
it cans store the address of num ------| ptr = #
and you can use to set data also ------| *ptr = 7 // now num =7

you can make pointer to any kind of data
you want even a type of data you wrote it
like classes or structure

Report •

July 10, 2011 at 22:53:50
Pointervariables 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.


Report •

Related Solutions

Ask Question