Grabbing frogs...

Pointing Something Out

I'm trying to fix this old C program, but I don't understand pointer arithmetic. Can you help me?


Sure! Pointer arithmetic is really simple.


You use these fingers here, and count them. One plus one is two.


How do I apply that to my program?

Type with these same fingers!

You get a very similar answer from that frog if you ask questions about an index.

Alright, I know many of you just come here for silly frog puns and don't understand what pointer arithmetic is really supposed to be. In some languages like C and C++, a variable can be a pointer to the memory location of an item in a list. Adding to and subtracting from such a variable will change which item in the list is being referenced by the pointer. It's kind of a low-level language feature that isn't available in languages like Java and Python, mostly to prevent programmers from making mistakes. Old timers like myself remember using them (and making lots of mistakes with them).

Published Wednesday, 14 September 2022

Vote for us on!
Our Current Rank is: 0