Beginner: How to declare pointers ?
-
Hi, I am just starting to learn C(++) and therefore the following might be a silly question to you. But maybe your explanations will help me to understand some principles of C++: As far as I know pointers are declared like
char *xyz
(with the * bound to the beginning of the variable name). But in the C++/MFC-Help, pointers are mostly declared asCWnd* xyz
(the * is following the type/class name). What is the difference? Thx a lot Christian Planckh -
Hi, I am just starting to learn C(++) and therefore the following might be a silly question to you. But maybe your explanations will help me to understand some principles of C++: As far as I know pointers are declared like
char *xyz
(with the * bound to the beginning of the variable name). But in the C++/MFC-Help, pointers are mostly declared asCWnd* xyz
(the * is following the type/class name). What is the difference? Thx a lot Christian PlanckhThere is no difference. It's just a matter of style. You can put as little or as much whitespace as you want. The following would all be OK:
char*xyz; char *xyz; char* xyz; char * xyz;