My best/messiest code so far (work in progress)
etian (31)

So as no one knows, for school I've been working on a tic tac toe game and its pretty fun! I tried doing some coding now but I look through all the code and its completely fine but I guess my home wifi is too laggy. :/

You are viewing a single comment. View All
Highwayman (204)

@etian well it looks like you forgot to put a comma between spot2 and test3 on line 6, so there’s that...
Um, hmm..
you are trying to make test be equal to an array of characters, but it is an int. If you are thinking about the fact that test is at least 4 bytes long and a[n] will be only three bytes long, then I suggest putting in an actual cast to int so that that is more clear, if not, then that isn’t great, and I wouldn’t encourage it anyways, just use a new array of chars.

It seems like that’s the big thing there, you are make test 1 , 2 and 3 be equal to the arrays instead of the characters.

So

You created your array (a) like so.

// I want an array of arrays
char a[][] = { { 'T' ,  'i',   'c' },
                { 'T' , 'a' , 'c' },
                { 'T' , 'o' , 'e' } };

And then you set test to the first array of a, instead of the first element of the first array. Like so.

test = a[0]; // so you basically are setting it to { 'T' , 'i' , 'c' }; , instead of 'T' .