C++ does not check array bounds. If you access nums[10] on a 5-element array, the compiler will not stop you. This causes undefined behavior. Undefined behavior means anything can happen.
The program might crash, corrupt other variables, or appear to work fine. Results are unpredictable. Always ensure indices are within bounds. Valid indices are 0 to N-1. Use i < N in loops.
Bounds errors cause bugs and security vulnerabilities.