On Tue, 5 Dec 2000, Richard M. Hartman wrote:
>
> <<<<<
> S.V.BADARI NARAYANA MURTHY wrote in message <31992@palm-dev-forum>...
>
> hai all
>
> I want to store "?" into a Char*. if i give like this
>
> Char* temp;
> temp="?";
>
> it will store "\?". why its adding \ before ?. how to store only "?".
> if
> any one have idea regarding this, please help me.
>
>
> >>>>>
>
> Now aside from what Morgan wrote about what the backslash
> really means, you have other problems.
>
> First off, "Char *temp;" is declaring a variable which will be a
> -pointer- to some memory into which you in intend to store
> Chars ... but you never gave it any memory to point -to-. Look
> at MemHandleNew() and MemPtrNew(). Don't forget the matching
> deletes once you're done w/ the memory !
Not quite true. Technically he did allocate memory. the literal string
"?" allocates memory for the '?' character. There may be a problem with
the life of this storage but it is allocated and does exist. "?" means
pointer to memory containing the string that contains just the '?' plus
string terminator.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/