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...

what is the difference between char * const and const char
*?

Answer Posted / yathish nm yadav

CHAR * CONST
means we are making the variable of type
char* as constant i.e,
ex:
char * const p;
means pointer variable p is made constant i.e, its lvalue
is been blocked by compiler at compile time.
ex:
char c;
char *const p= &c;
here p contains the adress of c and we cannot make p now to
point to some other variable.
char t;
p=t; //compile time error.

CONST CHAR *
means the variable pointed to by the const char * is made
constant. i,e.
ex:
char c='a';
const char *p=&c;
here c is made constant n its lvalue is being blocked.
now we cannot change the value of c since it is made
constant.
i.e,
*p='b'; // error

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how do I determine whether a character is numeric, alphabetic, and so on?

1085


What is the use of getch ()?

1039


What is break statement?

1061


What are the scope of static variables?

1119


Explain what is the difference between text files and binary files?

1100


How to find a missed value, if you want to store 100 values in a 99 sized array?

1366


What are the uses of a pointer?

1103


Is it cc or c in a letter?

960


What is the best way to store flag values in a program?

1012


Where are local variables stored in c?

985


Explain what is wrong with this program statement? Void = 10;

1196


Is c compiled or interpreted?

1130


Discuss the function of conditional operator, size of operator and comma operator with examples.

1099


What is c mainly used for?

1004


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1713