hi pals,
can any body explain the difference between
char *x = "criticalboot";
char x[] = "criticalboot";
thnx in advance
hi pals,
can any body explain the difference between
char *x = "criticalboot";
char x[] = "criticalboot";
thnx in advance
The first stores the address of a constant string that is held somewhere else in your code.
The second creates a space large enough to hold your string [including the final zero], and stores the string in that space.
In old times, it would make little difference, but in modern compilers, the first form is read only, and should therefore beso that you can't accidentally write code that tries to modify the value.Code:const char *x = "criticalboot";
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Thanks Mats its help me a lot.