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 if your architecture only has 8-bit pointers then this output makes perfect sense
@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
@jordyd yeah it printed the whole thing but I got a segmentation fault
@arisunz I think what we’re seeing here is what C programmers call “black magic”. It works, ... for now. Correct way to do this would be to make the last element in the array `NULL` and then use `int i = 0; while (menu[i]) { printf("%s", menu[i]); i++ }`
@arisunz oh if you got a segfault then everything makes sense
@arisunz imagine I put a semicolon after the `i++`
@arisunz (sizeof(char*) gives the size of a pointer, which is 4 on 32 but machines, btw)
@arisunz also note that sizeof(char*) == sizeof(void*) == sizeof(anything*)
@jordyd Thank you for the explanations! I really need to watch my way around pointers...
@jordyd and basically do NOT rely in any way shape or form on anything that could be platform-specific
@arisunz well, C is not great for cross-platforminess :)
@arisunz it’s a good idea to understand C, and then never touch it again if you can avoid it
@jordyd Yeah I'm diving right into Rust after I'm ""done"" with C
@arisunz If C lets you shoot yourself in the foot, Rust starts screaming if you so much as look at a gun
@jordyd I kinda like that about it, I feel like Rust forces you to learn elegant, thought out coding styles and practices from the get go
though I also like a loaded, unsafe shotgun as much as anyone
@jordyd also I ugly laughed at that xD
@arisunz oh I totally agree
@arisunz in that case it takes the middle road between sense and nonsense, and should print the first two lines instead
@jordyd what the fuck
@jordyd Shit, maybe. I'm on a 32-bit machine.
Don't ask why, it's sad.