Skip to content

BUG: Undefined reference to 'isValidMove' and Compilation Error in tictactoe2.c #20

Description

@Tanvidotcom

Problem:

The source file tictactoe2.c contains a call to a function named isValidMove() within the main function. However, this function is never defined or declared within the tictactoe2.c. While a function with this name exists in tictactoe.c, the lack of a local definition in this specific file results in an "undefined reference" linker error during the build process.

Proposed Solution:

  • Define isValidMove function within the tictactoe2.c
  • Implement boundary checking to ensure the input integer is between 1 and 9.
  • Add a check to verify if corressponding board[row][col] is currently an empty space (' ')
  • Update the turn-switching logic so that the player variable only toggles when a valid move is successfully completed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions