const char *

char * const

What is the differnce between the above two?

Answers were Sorted based on User's Feedback



const char * char * const What is the differnce between the above two?..

Answer / karthik natarajan

const char * makes the data constant

char * constant makes the pointer constant

Is This Answer Correct ?    24 Yes 1 No

const char * char * const What is the differnce between the above two?..

Answer / p s

const char *s; is a non-const pointer to const char
char * const s; is a const pointer to non-const char

Once u assign a value to the const poinet it cannot be
reassigned another value till u use casting techniques..

char a = 'A';
char b = 'B';
char *const c = &a;
c = &b; //flags an errror

const char *s = &a;
s = &b //works

Is This Answer Correct ?    19 Yes 0 No

const char * char * const What is the differnce between the above two?..

Answer / beula

const char * is the pointer to a consant variable.
char * constant is a constant pointer to a char.

Is This Answer Correct ?    10 Yes 1 No

const char * char * const What is the differnce between the above two?..

Answer / atreyee

char * const, the pointer is declared as constant.
const char *, the pointer is not constant.

Is This Answer Correct ?    4 Yes 2 No

const char * char * const What is the differnce between the above two?..

Answer / sowmya.....

const char * is a constant pointer but,....
char * const is a pointer to constant

Is This Answer Correct ?    2 Yes 1 No

const char * char * const What is the differnce between the above two?..

Answer / sahithi

const char* /*string is fixed pointer is not*/
char *const /*pointer is fixed string is not*/

Is This Answer Correct ?    0 Yes 0 No

const char * char * const What is the differnce between the above two?..

Answer / vidushi

Both are the method to declare a character pointer. but char
*const means pointer is sticked to accept a single address
but in case of const char * means u can assign it to
different variable address to it.

Is This Answer Correct ?    0 Yes 2 No

const char * char * const What is the differnce between the above two?..

Answer / chithra

const char* is a constant pointer and char * const is
poiter to constant.

Is This Answer Correct ?    5 Yes 9 No

const char * char * const What is the differnce between the above two?..

Answer / priya

we can assign char as a constant but we cannot assign
constant as a character

Is This Answer Correct ?    1 Yes 7 No

const char * char * const What is the differnce between the above two?..

Answer / jeeva

both are same

Is This Answer Correct ?    1 Yes 17 No

Post New Answer

More C++ General Interview Questions

Differentiate between a template class and class template?

1 Answers  


What is pointer to member?

0 Answers  


Explain the scope of resolution operator.

0 Answers  


What does getch() do according to the ANSI C++ standard a) Reads in a character b) Checks the keyboard buffer c) Nothing in particular (Its not defined there)

0 Answers  


Write a program to calculate the BMI of a person using the formula BMI = weight/height2.

2 Answers  






List out some of the OODBMS available?

1 Answers  


What is a base class?

0 Answers  


What is c++ array?

0 Answers  


What is object oriented programming (oop)?

0 Answers  


How does the copy constructor differ from the assignment operator (=)?

0 Answers  


What are pointer-to-members in C++? Give their syntax.

0 Answers   HAL,


Write a c++ code that will calculate the roots of a quadratic equation a2+ bx+c=0 Hint: d = sqrt (b2-4ac), and the roots are: x1 = (€“b + d)/2a and x2 = (€“b €“ d)/2a (use sqrt function from cmath.h )?

0 Answers   Maxobiz,


Categories