const char *
char * const
What is the differnce between the above two?
Answer Posted / 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 |
Post New Answer View All Answers
What type of question are asked in GE code writing test based on c++ data structures and pointers?
Define the process of error-handling in case of constructor failure?
When should overload new operator on a global basis or a class basis?
write a porgram in c++ that reads an integer and print the biggest digit in the number
Can we use clrscr in c++?
Difference between class and structure.
Will a catch statement catch a derived exception if it is looking for the base class?
What is guard code in c++?
What is token c++?
Discussion on error handling of C++ .
Why is c++ so fast?
If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
Describe protected access specifiers?
A prime number is a number which is divisible only by itself and 1. Examples of the first few primes are 2, 3, 5, 7, 11. Consider writing a program which can generate prime numbers for you. Your program should read in and set a maximum prime to generate and a minimum number to start with when looking for primes. This program should be able to perform the following tasks: 1. Read the maximum number from user (keyboard input) to look for primes. The program should not return any primes greater than this number. 2. Read the minimum number from user (keyboard input) to look for primes. The program should not return any primes less than this number. 3. Generate and print out every prime number between the maximum prime and minimum number specified by the user.
Why do we use setw in c++?