initializing char and char pointers
Posted
by ra170
on Stack Overflow
See other posts from Stack Overflow
or by ra170
Published on 2010-04-06T18:37:00Z
Indexed on
2010/04/06
18:43 UTC
Read the original article
Hit count: 676
What's the difference between these:
This one works:
char* pEmpty = new char; *pEmpty = 'x';
However if I try doing:
char* pEmpty = NULL; pEmpty = 'x'; // <---- doesn't work!
and:
char* pEmpty = "x"; // putting in double quotes works! why??
© Stack Overflow or respective owner