Ask coding questions

← Back to all posts
seg fault when returning from function
JBrockF (0)

Making a program that can display a connect 4 game. After each turn I am having the checkwin function check for 4 in a row vertically. The value returned by checkwin controls the game loop. Returning a 1 (to continue the loop) works fine but returning 0 in checkwin (to end the loop) seg faults. I know there are some unnecessary variables and some debugging statements in here that I'll have to clean up but I don't understand why it seg faults when a win is found. Also don't use column 0 for input when testing it does not work correctly at the moment.