Search:
Forum
Beginners
Char *
Char *
Jun 19, 2010 at 3:42am UTC
dasman
(9)
Hi,
I was just wondering about this, Char * s = "aaaaa" is valid, it creates a pointer to char and also points to "aaaaa". But why doesn't int * p = 45 work?.
Jun 19, 2010 at 3:49am UTC
Albatross
(4553)
Because "aaaaa" is a pointer to a block of memory that contains aaaaa. That's what double-quoted data is: a char*. 45, however is a plain integer.
-Albatross
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs