Why do we use “int *p” over “int* p”? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why do we use “int *p” over “int* p”?

Please, describe the method clearly.

15th Dec 2017, 4:07 PM
Bits!
3 Answers
+ 6
Technically, those are the same as compilers ignore whitespace. It is more important when you do something like this: int *p, a[10], c; It helps the person reading it to see the fact that p is a pointer to int, a is an array of 10 int, and c is a regular int.
15th Dec 2017, 4:22 PM
John Wells
John Wells - avatar
+ 3
John Wells thanks 😍
24th Jul 2020, 2:07 AM
Bits!
+ 2
@john Wells. yes true, and still i would not recommend piling up declarations on the same line like that in the first place:-)
15th Dec 2017, 6:52 PM
ifl
ifl - avatar