Re:Everything I wish I knew when learning C
by Koshkin on Monday November 28, 2022 @12:56PM
(#33776931)
Well there’s a little bit more to it. There is a type involved, and then there’s pointer arithmetic.
[ Parent
| on HN ]
Re:Everything I wish I knew when learning C
by Sohcahtoa82 on Monday November 28, 2022 @01:12PM
(#33777194)
Well yes, but those aren't hard.
Pointer arithmetic is merely knowing that any addition/subtraction done to a pointer is multiplied by the size of the type being pointed to. So if you're pointing to a 64-byte struct, then "ptr++;" adds 64 to the pointer.