Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

let's say I have an 2d array of char. a player is marked p and I want to move p without duplications in the 2d

let's say I have an 2d array of char. a player is marked p and I want to move p without duplications in the 2d array like this

1 2 p 4 5 6 7 8 9

to this

1 2 3 p 5 6 7 8 9

this function is what I tried so far. when I test this function it duplicates the player p as I keep asking for a row and column number. I know the picture is crooked since I am using the chegg app. I am also new to the c language

image text in transcribed

image text in transcribed

== if (board[row][col] 'A') { board[row][col] != marker;// dont place p onto a } else { /* a basic swapping position. It making a new copy of the char p at a new position. That is where I think that is where the logic fails. */ char temp = board[row][col]; board[row][col] = old_marker; board[row][col] = marker; marker temp; = } void place_mark_in_neighborhood_board(char board[ROWS] [COLS], char mark, int row, int col) 1 char marker mark; int last_position_x = row; int last_position_y col; = char old_marker = board[last_position_x][last_position_y]; for (int i = row ? row 1 : row; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions