We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have a C. OK recently i decided to make a naughts and crosses program but soon found out that it was harder than i thought because i had to use matrix and i don't have a clue how to use them or what it is. can someone please give me a hand or explain what i need to do? P.S. I got rid of the failed program before i thought of posting in the forum.
1) This is standard C, so you can find a lot of nice explanations of one-dimensional or multi-dimensional arrays in C.
2) You can either use a two-dimensional array:
char board_data[BOARD_SIZE][BOARD_SIZE];
or you can use a one-dimensional array - a vector:
char board_data[BOARD_SIZE*BOARD_SIZE];
The only difference is if you will address your data as:
if (board_data[x][y] == 'x') { ... }
or as:
if (board_data[x*BOARD_SIZE+y] == 'x') { ... }
3) The really interesting part is how you plan to build an embedded system (this is a forum for embedded systems, or more specifically for the use of Keil tools to create the software for embedded systems).
Did you plan to create a an array of two-colored LEDs and use one color for a cross and the other color for naughts?
OK recently i decided
You "decided", as opposed to "you were given this homework project". Who do yo think you're kidding?
i had to use matrix and i don't have a clue how to use them or what it is.
Yeah, right. So how come you know you "had" to use matrices, given as you so freely admit you don't even know what they are?
What do they mean?