Ask HN: Better language than C for playing with pointers

1 points by slindsey ↗ HN
In over 20 years of software development, I've only worked with languages that don't use pointers. Each time I delve into pointers in C, I run into problems referencing and de-referencing, passing them around, etc. I understand pointers well enough. I've read countless tutorials and really do understand them at the machine level.

Can anyone recommend a language other than C that uses pointers, so that I might understand actual manipulation better? I'm not interested in a discussion of why they are bad and how we should use Rust. This is purely for my own education to get past this weird block I seem to have when I try to use them in real applications.

4 comments

[ 0.28 ms ] story [ 29.3 ms ] thread
c++11!

Really it's just a matter of actually doing it. I read books, I studied, I "knew" how they worked, but until I wrote a linked list from scratch and actually used it for a while I really didn't understand it.

Zig maybe. While it is still in a quite early phase it in my eyes keep much closer to C syntax and language feeling than C++, while still having smart new solutions. Some of these are in the pointer domain.

For example it has a couple of different pointer types for the different ways arrays can be handled in C, such as Null terminated, compile-time-known size or runtime-known size. This could help you think about how pointers and collections go together.

Golang uses pointers and is a descendant of C, so you should feel at home.
Really? Cool. I don't know why, but I've avoided Go for some reason. I didn't even realize it had pointers. Thanks.