jeudi 29 juin 2017

2 Dimension Passing (missing subscript, unknown size)

I am constantly getting a missing subscript and unknown size problem. So, I am guessing this is a beginner problem but I can't get my head around it. How do I get my function to work and outputted to the screen?

I am trying to have two columns be filled with numbers. Column[0] is inputted by rand() and then have Column[1] be converted into a new number through an equation. I am expecting 1-20 rows to be inputted.

void arrayProgram(double ma[][1], int xSize);

double ma[1][1];
arrayProgram(ma, 1);


void arrayProgram(double ma[][1], int xSize)
{

    int i = 0;

    for (i = 0; i < xSize; ++i)
    {
        ma[i][0] = rand();
        ma[i][1] = (ma[i][0] * (20 / 25.0) + 64);
    }

}

Aucun commentaire:

Enregistrer un commentaire