This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
Hi,
I am experiencing this behavior...
//This global declaration is linked to .econst
static unsigned char * Array = "string\0";
//This global declaration is linked to .ebss
static unsigned char Array[7] = {'s', 't', 'r', 'i', 'n', 'g','\0' };
I would expect both of these to be linked to .ebss. Why is the first considered a constant without the "const" keyword? Is this standard?
Regards,
sal
I thought I would point out a few additional details. These details can be a bit confusing at first. But, for a complete understanding, I thought I would point them out.
You don't need the \0 in ...
Sal Pezzino said:static unsigned char * Array = "string\0";
It is always added to the end of a "quoted string". However, you do need the \0 in ...
Sal Pezzino said:static unsigned char Array[7] = {'s', 't', 'r', 'i', 'n', 'g','\0' };
... because you explicitly specify each character value. An equivalent way to write the second (not first) example is ...
unsigned char Array[] = "string";
Note how you don't need the \0.
Thanks and regards,
-George