execvp: bad address error
The code seems to miss to NULL-terminate arrays[k]. Make the last entry in arrays[k] carry NULL. Update: This should be of even more straight forward just: as the members of the exec*()-family of functions return on error only.