Why does int* ptr_a, ptr_b; make ptr_b an int not a pointer?

  • Thread starter transgalactic
  • Start date
2 replies · 3K views · last reply
transgalactic
Messages
1,386
Reaction score
0
when i declare

Code:
int* ptr_a, ptr_b;

why the type of ptr_b is int
and not int*

?
 
Because
Code:
int *pta_a, ptr_b;
means
Code:
int *pta_a; int ptr_b;
and not
Code:
int *pta_a; int *ptr_b;
which would be
Code:
int *pta_a, *pta_b;
.