We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
No it works probably because the 4 bytes before is accessible and contains 0.
This is a classical undefined behavior case and a case of « it works on my computer syndroma ».
Running compiling/running this code with a different compiler (or on a different arch) may break. Just test it with address sanitizer (-fsanitize=address in gcc/clang) or a similar tool …
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Array
You are viewing a single comment's thread. Return to all comments →
No it works probably because the 4 bytes before is accessible and contains 0.
This is a classical undefined behavior case and a case of « it works on my computer syndroma ».
Running compiling/running this code with a different compiler (or on a different arch) may break. Just test it with address sanitizer (-fsanitize=address in gcc/clang) or a similar tool …