+ 5

Pointers in c++

What’s the difference between int* v and int *v?

14th Jun 2020, 10:01 AM
Faez Mahmoudi
Faez Mahmoudi - avatar
2 Answers
+ 2
they are same in fact
15th Jun 2020, 4:14 PM
Faez Mahmoudi
Faez Mahmoudi - avatar
+ 8
No difference when there's only one definition in the line. Difference will be noticeable when multiple variable are defined in a single line. int* a, b, c; // Here <a> is an `int` pointer, <b> and <c> are `int` int *a, *b, *c; // Here <a>, <b> and <c> are all `int` pointers int *a; int* b; // No difference, only one variable definition per the line.
14th Jun 2020, 10:09 AM
Ipang