Could someone help me find what went wrong in this program? This is a megamax algorithm for the game Gomoku, forming 5 in a row on a 19*19 board. It's not very optimized, and keeps crashing
See the warnings that are generated (Microsoft compiler with -W4 -analyze)
line 166 : Buffer overrun while writing to 'board[r]': the writable size is '19' bytes, but '-1' bytes might be written.
line 165 : Reading invalid data from 'board[r]': the readable size is '19' bytes, but '-1' bytes may be read.
line 359 : Index '360' is out of valid index range '0' to '18' for possibly stack allocated buffer 'game.board'.
line 330 : Reading invalid data from 'game.board[r]': the readable size is '19' bytes, but '-1' bytes may be read.
line 331 : Buffer overrun while writing to 'game.board[r]': the writable size is '19' bytes, but '-1' bytes might be written.
line 305 : Buffer overrun while writing to 'game.board': the writable size is '361' bytes, but '-19' bytes might be written.
line 195 : 'negamax': not all control paths return a value