i have made a simple chess program using arrays and functions which check whether a king is in check in any given configration of chess board.if a king is in check then which king is i.e white or black.
in some cases
1- it give no output but give segmentation fault at run time.
2- it give output along with segmentation fault.
3- sometime its input loop does not terminat Can you tell me!
WHAT is segmentation fault?
What are the usuall reasons behind segmentation fault?
What may be the reasons in this case?
Is it compiler or envirment dependent?
To simplify. Your trying to access a memory location that is invalid. This is either by going too far into an array, or access a pointer that is no longer valid.
e.g
1 2 3
char myArray[10] = {0};
myArray[0] = 'A'; // Valid
myArray[10] = 'B'; // Error -usually SegFault, 9 Is Highest We can index