+ 1

Where is the error (C#)?

Hello. Can somebody please help me find a bug in my program? I have a 3*3 table that is stored as cells with reference to the 4 cells that touch them. The cells are stored in a one dimensional array. After creating all needed cells, I itterate through the array and connect all neighboring cells with storing their reference in a variable that belongs to the other cell. However when I try to print the table by using only the central cell and it's references to the other cells, I get the nullPoinerException, even when all references should be filled. My table (and output of the code) should look like this: X O#O X And here is the code: https://code.sololearn.com/cOVl8k7exqHf/?ref=app

27th Oct 2018, 7:48 AM
Jan Ơtěch
Jan Ơtěch - avatar
2 Answers
+ 1
I used your inputs listed in lines 11 to 20 and didn't get an exception so I'm guessing you found & fixed this.
2nd Nov 2018, 2:32 AM
John Wells
John Wells - avatar
+ 1
Yea... i fixed it and forgot to write it here. Sorry for wasting your time.
2nd Nov 2018, 6:31 AM
Jan Ơtěch
Jan Ơtěch - avatar