const char *
char * const
What is the differnce between the above two?
Answers were Sorted based on User's Feedback
Answer / karthik natarajan
const char * makes the data constant
char * constant makes the pointer constant
Is This Answer Correct ? | 24 Yes | 1 No |
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 |
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 |
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 |
Answer / sowmya.....
const char * is a constant pointer but,....
char * const is a pointer to constant
Is This Answer Correct ? | 2 Yes | 1 No |
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 |
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 |
how to explain our contribution in the project?
How to demonstrate the use of a variable?
What are the general quetions are in DEna bank manager IT/System interviews?
Can we specify variable field width in a scanf() format string? If possible how?
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
State two differences between C and C++.
Why do we need pointers?
Explain how overloading takes place in c++?
What is a storage class used in c++?
What is a node class in c++?
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
What is the type of 'this' pointer? When does it get created?