0
case 'A':
        x,y = Option1(Games,TotalGames);
        Games[TotalGames, 0] = x;
        TotalGames++;
        break;

Firstly, this is my current case A and my measly attempt to change the array value. Every time I do this it says the array is not modifiable.

int Option1(int a[100][2],int c) {
    int x;
    int y;
    printf("Enter your score:\n");
    scanf("%i", &x);
    printf("Enter your opponent's score:\n");
    scanf("%i", &y);
    return x,y;
}

This is the function that calculates the values that will connect to specific array sections. Note: we have to have separate functions for this.

void Option2(int a[100][2], int c) {
    int i, j = 0;
    int win=0, loss=0, tie=0;
    for (i = 0; i < c; i++) {
        if (a[i, j] > a[i, j+1]) {
            win++;
        }
        else if (a[i, j] < a[i, j+1]) {
            loss++;
        }
        else {
            tie++;
        }
    }
    printf("Current Records:\n");
    printf("Wins: %i\nLosses: %i\nTies:%i \n", win, loss, tie);
    return;
}

This is the code that keeps registering it all as ties. This is what made me realize none of the array values were sharing. Anyone got any tips?

Andy
  • 377
  • 6
  • 10
  • 1
    Hi, welcome to SO. Can you please explain to me why you do this? `x,y = Option1(Games,TotalGames);` – Iharob Al Asimi Jan 22 '22 at 04:27
  • To be honest, I thought that's how you give return values of outside functions value in the main. Maybe I am mistaken, that might be why it is so confusing. – Throw Away Jan 22 '22 at 04:32
  • 3
    You are using `,` in the wrong way in many places in that code. Please see [What does the comma operator , do?](https://stackoverflow.com/questions/52550/what-does-the-comma-operator-do). Fix all those first. Also note that C functions can only have one return value (unlike other languages like python). – kaylum Jan 22 '22 at 04:33
  • 3
    @ThrowAway I suggest reading as much as you can about C's syntax. It seems that you do know some other language and then you're trying to apply ideas you know from those languages to this. – Iharob Al Asimi Jan 22 '22 at 04:39
  • The most important thing to learn right now is [how to use a debugger](https://idownvotedbecau.se/nodebugging/). – Dour High Arch Jan 23 '22 at 02:40

0 Answers0