answersLogoWhite

0


Best Answer

A simple variable is a variable that stores a value, while a pointer variable is a one that points to a location where a value can be stored (It stores the address of a variable).

For eg:

int a=2,b;

b=a;

a=3;

cout<

Here the output will be 3 2. It's simple and clear.

While, if you use a pointer,

int *a=2,*b;

b=a;

*a=3;

cout<<*a<<" "<<*b;

Here the output will be 3 3.

That's because a stores the address of a location in memory where 2 is stored and the statement b=aassigns the same address to b and now a and bboth point to the same location and when you change the value at a value at b is also changed because both are the same.

The advantage of using pointer variable is:

In functions, a function can return only one value, but when pointers are used as arguments the function works as if returning multiple values.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between pointer vairableandsimple vairablewhat are the advantage of pointer vairable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a Vairable?

what is variable


Does an independent vairable change?

yes it does


To get the vairable by itself means?

I hhhhhh


What is random variation?

a vairable which outcomes are recorded with an estimate on it


What is dependant vairable?

The dependent variable is the factor being measured


Which type of annuity typically utilizes mutual funds?

vairable Variable


What does the independent and dependent vairable mean?

The independant is the thing you are changing and the dependant is the measure


What is a uncontrolled vairable?

* factors which are not considered in the experimental design * shouldn't have any effect on the experiment


What does it mean when a vairable is in a fraction?

It means some aspect of the fraction in a variable. No big deal!


Can you add a vairable with a number?

What, in a programming language? Sure. Anything that has a clearly defined value can be added.


In algebra adding the opposite to both sides of an equation is a process better known as what?

I'm pretty sure you mean balancing an equation to solve for a particular vairable


What is an indepentdant vairable?

It a Factor that is Intentionally varied by the experimenter in Retarded terms it means something that's experimented with many different times trying to get a certain result