Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8508133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:04:29+00:00 2026-06-11T03:04:29+00:00

When a coordinate is selected, it should be replaced with a ~. However, it’s

  • 0

When a coordinate is selected, it should be replaced with a “~”. However, it’s being replaced with the ascii value for the ~ instead (126). I tried a few different things, but I always get the 126 instead of the ~. Any ideas?
Thanks for the help!

int board_is_empty(int N, int board[ROWS][COLS])
{
    int i = 0, j = 0;
    for (i = 0; i < N; i++)
    {
        for (j = 0; j < N; j++)
        {
            if (board[i][j] != '~')
            {
                return 0;
            }
        }
    }
    return 1;
}

//updates the board to replace each selected coordinate with a ~.
//returns nothing
void update_board (int board[ROWS][COLS], int row_target, int column_target)
{

    board[row_target][column_target] = '~';
}

int main(void)
{
    int game_board[ROWS][COLS] = {0};
    int rows, columns = 0;
    int players_turn = 1, target_column = -1, target_row = -1, value = 0;
    int row_selection = 0, column_selection = 0;
    int i = 0;

    initialize_game_board(game_board);
    display_board(game_board);
    generate_starting_point(game_board, &rows, &columns);

    printf ("\nPlease hit <Enter> to continue.\n");
    getchar ();

    while (board_is_empty(ROWS, game_board) != 1)
    {
        select_target (&target_row, &target_column, players_turn);
        value += game_board[target_row][target_column];
        update_board (game_board, target_row, target_column); //should cause the coordinates at target_row && target_column to be replaced with a ~
        display_board(game_board);
    }
    printf("\n%d", value);

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:04:31+00:00Added an answer on June 11, 2026 at 3:04 am

    ‘~’ is a character and you have declared board as a two dimensional integer array.

    so when you write board[row_target][column_target] = ‘~’;

    it convert ‘~’ it into integer i.e into its ascii value which is 126
    and there for it becomes board[row_target][column_target] = 126

    I will suggest make board as two dimensional character array. Hopefully it will solve your problem.

    And in case if you want it as integer only then consider 126 as a special no which means ‘~’ by declaring

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of pickers, each of which have a pre-selected value such
I am having two coordinate points on Google map. I calculated the distance between
I have a coordinate from Core Location and want to calculate the co-ordinate given
JTS.orthodromicDistance(new Coordinate(0,0), new Coordinate(180,0), DefaultGeographicCRS.WGS84) * 2 is equal to 40075016 but must be
I'm writing some coordinate transformations (more specifically the Joukoswky Transform, Wikipedia Joukowsky Transform ),
I have a coordinate region that I have determined contains the limits of what
I have a lat/long coordinate point and I'm drawing a polygon (hexagon) around it
I'm trying to find UIElement from coordinate in my Silverlight for WP7 application. Here
I need to use something to coordinate my system with several consumers/producers each running
I have a struct called coordinate which is contained in a list in another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.