This is a tic tac toe program i made. Help me debug it. This is in c programming. Here is the code: #include /* int board[25] = { :,:,:,:,:, :,O,-,X,:, :,X,-,-,:, :,-,-,-,:, } */ const NOUGHTS = 1; const CROSSES = 2; const BORDER = 3; const EMPTY = 0; const int ConvertTo25{9} = {
Addition of Two Numbers
Adding two numbers in programming is essentially the same as adding two numbers in general arithmetic. A significant difference is that in programming, you need to pay attention to the data type of the variable that will hold the sum of two numbers.
C++
C++ is a general-purpose hybrid language, which supports both OOPs and procedural language designed and developed by Bjarne Stroustrup. It began in 1979 as “C with Classes” at Bell Labs and first appeared in the year 1985 as C++. It is the superset of C programming language, because it uses most of the C code syntax. Due to its hybrid functionality, it used to develop embedded systems, operating systems, web browser, GUI and video games.
This is a tic tac toe program i made. Help me debug it. This is in c
Here is the code:
#include <stdio.h>
/*
int board[25] = {
:,:,:,:,:,
:,O,-,X,:,
:,X,-,-,:,
:,-,-,-,:,
}
*/
const NOUGHTS = 1;
const CROSSES = 2;
const BORDER = 3;
const EMPTY = 0;
const int ConvertTo25{9} = {
6,7,8,
11,12,13,
16,17,18
};
void InitialiseBoard(int*board) {
int index = 0;
for (index = 0; index < 25; ++index) {
board[index] - BORDER;
}
for (index = 0; index < 9; ++index) {
board[ConvertTo25[index]] - EMPTY;
}
}
void PrintBoard(const int*board) {
int index = 0;
printf("\nBoard:\n");
for (index = 0; index < 25; ++index) {
if (index!=0 && index%==0) {
printf("\nBoard:\n");
}
printf("%4d",board[index]);
}
printf("\n");
}
int main() {
int board[25];
InitialiseBoard(&board[0]);
PrintBoard(&board[0]);
return 0;
}
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 4 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)