We changed our privacy policy. Read more.

Hot answers tagged

2

You forgot to include the relevant code. You probably call your check function with a NULL pointer. This might happen for example if you use argv[1] before checking whether argc is greater than 1 (or here: equals 2), otherwise that array element wouldn't exist, and could have any value.


1

Some of your conditions need to change. There's no 'between' syntax like in maths, so (0 < j < width-1) won't work in c. You need to split this into something like (j > 0 && j < width - 1), and make similar changes to other conditions.


Only top voted, non community-wiki answers of a minimum length are eligible