Different between const char * and const char const*
-
Hi, what is different between const char * and const char const *.
-
Hi, what is different between const char * and const char const *.
I would like to think the best answer to this question lies in actually coding something up and experimenting with the two to see what can and cannot be done. Has this form of research died off?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hi, what is different between const char * and const char const *.
I hope i say it right ... a char * is a pointer on a char-array where you can change all chars into the string. a const char* is a pointer on a string which you can't change, because he is declared or really constant ( for example "test" is a constant string in your memory, you can't change it) and a const char const * is even the pointer constant. That means if the pointer is initializated you can't re-use him const char const *locked = malloc(sizeof(char)*5); ... locked = malloc(sizeof(char)*15); --> DOESN'T WORK I hope i don't have sayed bullshit :)
-
Hi, what is different between const char * and const char const *.
Hi , The second way is wrong. we cannot use same type qualifier more than once. A type declaration or definition uses a type qualifier (const, volatile, signed, or unsigned) more than once. This causes a warning with Microsoft extensions (/Ze) and an error under ANSI compatibility (/Za).
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
-
Hi, what is different between const char * and const char const *.
mohindar_kks wrote:
what is different between
const $char *
andconst char const *
.If you exchange
const char const *
withconst char * const
, 'baerten' ist right. The order of words here is only important in that one const has to be before and one after the *
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
George Orwell, "Keep the Aspidistra Flying", Opening words -
I would like to think the best answer to this question lies in actually coding something up and experimenting with the two to see what can and cannot be done. Has this form of research died off?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
DavidCrow wrote:
Has this form of research died off?
Apparently, we're the last generation to know how to do this...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Hi, what is different between const char * and const char const *.
Hi , I have already given explaination for that please see the post by Shraddha Gautam 8:27 24 Sep '07 Short decription : Pointer To constent const char * and char const * both are same. Constent Pointer char * const Const Pointer to constent const char * const and char const * const both are same. Hiren Thakkar