3 ms·
heheh my initial version also explicitly added the 0, and then I also found a way to do it in the loop. Seems a common evolution. But your final solution is cl
by 10ren 16y ago
heheh my initial version also explicitly added the 0, and then I also found a way to do it in the loop. Seems a common evolution.
But your final solution is clearer than mine. While it uses an extra variable (register), it avoids looking up the same thing twice. So... more efficient and clearer.
BTW: TIL char * a = "hello"; doesn't work in C (I think it doesn't allocate memory). I'm actually happy enough that I could solve this at all, not having used C for 20 years ...old