Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

wats the diference btwen constant pointer and pointer to a
constant.pls give examples.

Answer Posted / monika sethi

CONSTANT POINTER: A pointer will always point to one
object.it is initialized at the time of declaration.
e.g
int i=20,j;
int* const p=&i;
cout<<*p; //will print 20
*p=30;//works....i.e the value pointed by the constant
pointer can be changed
//now if write
p=&j;//error

POINTER TO CONSTANT

it can be declared as
const int *p;
or
int const *p;
int i=10,j=30;
p=&i;
cout<<*p;
*p=10//error...the value is constant pointed by p
//pointer p is not constant so it can now point to another
variable of integer type
//so if we write
p=&j //it will now point to a variable j

that's all.........

Is This Answer Correct ?    27 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can i use “int” data type to store the value 32768? Why?

1231


What is a file descriptor in c?

1194


Write a progarm to find the length of string using switch case?

2120


What is the difference between NULL and NUL?

1351


Wt are the Buses in C Language

3262


Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

2334


What are lookup tables in c?

1033


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

1098


Tell us bitwise shift operators?

1141


What is an array? What the different types of arrays in c?

1251


Explain what is a 'locale'?

1126


process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,

2473


Can you write a programmer for FACTORIAL using recursion?

1096


I have seen function declarations that look like this

1091


Explain modulus operator.

1088