Timeline for What is correct syntax when declaring a pointer? (i.e. where to place the *?)
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 20, 2018 at 12:38 | comment | added | Blauelf |
They are the same, the whitespace is ignored. I'd like to add that char* word better describes the type of word (the * is part of the type, not of the name), but can lead to confusion. char* word, ch; declares two variables, but word is of type char* , while ch is of type char . char *word, ch; would have been less confusing. But usually avoid this kind of variable declaration.
|
|
Mar 20, 2018 at 9:51 | comment | added | doctopus |
Just to clarify, this also applies to other types of structs too right? i.e. char *word = "hello" would be the same as char* word = "hello" ?
|
|
Mar 20, 2018 at 9:50 | vote | accept | doctopus | ||
Mar 20, 2018 at 8:45 | history | answered | MARS | CC BY-SA 3.0 |