|
From: Nicolas R. <ni...@bo...> - 2004-05-28 14:41:59
|
Let me clarify something:
> What's going on behind the scenes there is that the string "hello"
> gets created "on the fly" by the compiler as a constant array of chars
> that contains {'h', 'e', 'l', 'l', 'o', \0}. Then you create a
> pointer-to-char called pszString. What does the assignment do? It just
> copies the address.
Which works because, just in the same way that the name of an array is
always a pointer, a constant string embedded in the code (a
"hard-coded" string) *is* an array, so "it" is a pointer. It just has
no name (until you copy its address to pszString, and from that moment
on you'll refer to it by that denomination, right?)
N.
|