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

What does the c in ctime mean?

1021


What is void main () in c?

1154


What is the most efficient way to count the number of bits which are set in an integer?

1003


Is return a keyword in c?

1032


Explain the use of function toupper() with and example code?

1081


Why pointers are used?

1026


How can you increase the size of a statically allocated array?

1034


Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

15732


Explain bitwise shift operators?

1174


what is event driven software and what is procedural driven software?

2514


What is the purpose of type declarations?

1079


Explain how does flowchart help in writing a program?

1064


How can I write functions that take a variable number of arguments?

1078


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

2136


Which is more efficient, a switch statement or an if else chain?

972