Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between int* p and int *p declaration [duplicate]

Tags:

c

What is the difference between an int* p and an int *p declaration?

like image 333
karthik Avatar asked Apr 08 '11 03:04

karthik


1 Answers

There is no difference.

It's a matter of notation, not semantics. The second is less misleading, because

int *a, b;

is clearly declaring an int* and an int, whereas

int* a, b;

looks as if it's declaring two pointers, when it's really doing the same thing as above.

like image 187
user541686 Avatar answered Sep 22 '22 10:09

user541686