JPDev@programming.dev to Programmer Humor@programming.dev · 8 months agoWhitespaceprogramming.devimagemessage-square10fedilinkarrow-up17arrow-down10
arrow-up17arrow-down1imageWhitespaceprogramming.devJPDev@programming.dev to Programmer Humor@programming.dev · 8 months agomessage-square10fedilink
minus-squareblackstrat@lemmy.fwgx.uklinkfedilinkarrow-up0·8 months agoThe fact it’s a pointer is part of the type, not part of the variable name. So int* p is the way.
minus-squaresweng@programming.devlinkfedilinkarrow-up1·edit-28 months agoYou would think so, but int* a, b is actually eqivalent to int* a; int b, so the asterisk actually does go with the name. Writing int* a, *b is inconsistent, so int *a, *b is the way to go.
The fact it’s a pointer is part of the type, not part of the variable name. So
int* p
is the way.You would think so, but
int* a, b
is actually eqivalent toint* a; int b
, so the asterisk actually does go with the name. Writingint* a, *b
is inconsistent, soint *a, *b
is the way to go.