Ari Myr is a user on octodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.

I did this out of pure dumb luck and now I don't understand how that division works or if it's even okay

This is how I'll actually become a programmer: out of pure, RAW luck

@arisunz by everything I know about C this should print exactly nothing

@arisunz if your architecture only has 8-bit pointers then this output makes perfect sense

@jordyd Shit, maybe. I'm on a 32-bit machine.

Don't ask why, it's sad.

@jordyd So the non-fucky way of doing this would be:

i < sizeof(menu) / sizeof(menu[0]),

right?

@arisunz actually `i < sizeof(menu)` should work. C treats static arrays differently than pointers, and reports the size as the number of elements

@arisunz actually I’m wrong it uses the total size

Ari Myr @arisunz

@jordyd yeah it printed the whole thing but I got a segmentation fault

· Web · 0 · 0