0

Hi All
I am programming a Black Jack. I made a procedure to calculate the Score of the Cards. Here is the code:

int calculatescore (int* spieler, int i0) //Der Score wird berechnet
{
    int ausgabe;
    int i1;
    int i2;
    for(i1=0; i1!=9; i1++)
    {
        if(spieler[i0][i1]!=0)
        {
            i2=spieler[i0][i1]%13;
            if(i2>=10)
            {
                ausgabe=ausgabe+10;
            }
            else if(i2==1)
            {
                ausgabe=ausgabe+11;
            }
            else
            {
                ausgabe=ausgabe+timer2;
            }
        }

    }
    return ausgabe;
}

When i compile the programm, i have the following Error:

subscripted value is neither array nor pointer

in line 8 and 10. Can you help me?

p.s. sorry for the bad english ;)

2
Contributors
1
Reply
4
Views
4 Years
Discussion Span
Last Post by L7Sqr
1

int* spieler indicates an array, not an array of arrays. I'd suggest that you change that to be int **spieler if you are, in fact, passing in a two-dimensional array. If you are not, then you can not index an int type with []. For type int *ip, the following returns an int: ip[x]

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.