F
fei.liu
Consider the following sample code
char * ptr = "hello";
char carray[] = "hello";
int main(void){
}
What does the standard have to say about the storage requirement
about ptr and carray? Is it a fair statement that char *ptr will take
4 more bytes (on 32bit platform) in DATA segment? I have found
the statement true at least with gcc 2.96. I assume under certain
condition the compiler can optimize the storage away?
Thanks for your comments,
Fei
char * ptr = "hello";
char carray[] = "hello";
int main(void){
}
What does the standard have to say about the storage requirement
about ptr and carray? Is it a fair statement that char *ptr will take
4 more bytes (on 32bit platform) in DATA segment? I have found
the statement true at least with gcc 2.96. I assume under certain
condition the compiler can optimize the storage away?
Thanks for your comments,
Fei