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

  • Thread starter Thread starter transgalactic
  • Start date Start date
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
2 replies · 3K views
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*

?
 
Physics news on Phys.org
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;
.