Help with this code and its algorithm¡¡¡¡¡¡

There seems to be a void (a hole, a gap) in your understanding.

Functions are called functions or subroutines, they are not called voids.

Please stop calling functions "voids"