Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2003
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    troubles..need help

    Hey... the problem I have I bet is a simple one to solve..
    It doesn't make sense to me why it isn't working but maybe someone can help...


    if I declare a char variable in C

    so:

    char Board[10][10]

    and then I use a for loop to go through it and set certain coordinates to a * symbol...

    for(LCV=0; LCV<Civ; LCV++)
    {
    printf("Row: ");
    scanf("%d", &Row);
    printf("\n");
    printf("Col: ");
    scanf("%d", &Col);

    Board[Row-1][Col-1] = '*';
    }

    assume everythings declared properly... the problem i'm having is its setting those spots in the array to 42... which is kinda frustrateing cause I can't get it to set those spots to the actual '*' character... lemmie know what ya think thanks!

    Lippy

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Somehow the * character is being outputted in its integer value, which is 42. Take a look at this ascii table and you'll see what I mean. Other than that, I can't help ya much because I don't know C++.

  • #3
    New Coder
    Join Date
    Nov 2003
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I figured it out
    was a very stupid mistake!
    but thanks for the reply


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •