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

how to explain our contribution in the project?

0 Answers   Wipro, Yahoo,


How to demonstrate the use of a variable?

0 Answers  


What are the general quetions are in DEna bank manager IT/System interviews?

0 Answers   Dena Bank, ICICI,


Can we specify variable field width in a scanf() format string? If possible how?

0 Answers  


Write a program to read the data and evaluate the results of the election. Print all output to the screen. Your output should specify: The total number of votes, the number of valid votes and the number of spoilt votes. The winner(s) of the election. Hint: An appropriate search should be used to determine the winner(s). The votes obtained by each candidate sorted in terms of the number of votes obtained. Hint: An appropriate sort should be used to sort the candidate(s). The Source code should be saved as VotingSystem. Project Input: Candidates’ Names and Numbers 2501 Victor Taylor 2502 Denise Duncan 2503 Kamal Ramdhan 2504 Michael Ali 2505 Anisa Sawh 2506 Carol Khan 2507 Gary Owen Votes 3 1 2 5 4 3 5 3 5 3 2 8 1 6 7 7 3 5 6 9 3 4 7 1 2 4 5 5 1 4 0 Project Output: Invalid vote: 8 Invalid vote: 9 Number of voters: 30 Number of valid votes: 28 Number of spoilt votes: 2 The winner(s): 2503 Kamal Ramdhan 2505 Anisa Sawh Candidate Score 2503 Kamal Ramdhan 6 2505 Anisa Sawh 6 2501 Victor Taylor 4 2504 Michael Ali 4 2502 Denise Duncan 3 2507 Gary Owen 3 2506 Carol Khan 2

0 Answers  






State two differences between C and C++.

0 Answers   Hexaware,


Why do we need pointers?

0 Answers  


Explain how overloading takes place in c++?

0 Answers  


What is a storage class used in c++?

0 Answers  


What is a node class in c++?

0 Answers  


What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?

0 Answers  


What is the type of 'this' pointer? When does it get created?

0 Answers  


Categories