| ▲ | throwaway2037 a day ago | |
His final solution is so tricky. I needed to re-read it a few times to understand the trick of using post decrement in the for loop condition. Personally, I would never write code like that. I would always find a way to use ssize_t. This part was an interesting requirement:
That seems like a lot of mental gymnastics to avoid this very simple macro:
Read about the Win32 macro SSIZE_T here: https://learn.microsoft.com/en-us/windows/win32/winprog/wind...To me, this solution is more readable and maintainable:
Alternatively, you can use a while loop where the condition appears at the end of the loop: | ||