void getScores(float **scores, int num)
Can someone help me understand what this means? Especially the **scores....
I know what a float is and that it is to get scores inputed in by the user.
Thanks

Recommended Answers

All 3 Replies

That appears to be a prototype for a function, at least in the context of there being no other evidence to the contrary.

float **scores looks like a pointer to a pointer to a float value.

Without anything else, there is not much to say about it.

Can someone help me understand what this means?

A function that takes a double pointer float and an int variable as a parameter

Especially the **scores....

It's a pointer to a pointer (research about pointers and 2D arrays), where modifying its value/s changes the value/s of the variables passed from the calling function

int getStudentCount();
void getScores(float **scores, int count);
void calculatePointGrades (float **scores, int count, float calculatedPointGrade[]);
void calculateLetterGrades(float calculatedPointGrade[], int count, char letterGrade[]);
void showGradeData(float **scores, int count, float calculatedPointGrade[], char letterGrade[]);

//start of program
int main()
{
    int count=getStudentCount();
    point-score (exam average, lab average and homework average) for all students*/
    float **scores;//[MAX_STUDENTS][3]; 
    scores = new float*[count];
    for (int i=0; i<count; i++){
        scores[i] = new float[3]; // create second dimension(s)
    }

    calculatedPointGrade=new float[count];
    char *letterGrade;
    letterGrade=new char[count];
    getScores(scores,count);
    calculatePointGrades(scores, count, calculatedPointGrade);
    calculateLetterGrades(calculatedPointGrade,count, letterGrade);
    showGradeData(scores,count,calculatedPointGrade, letterGrade);

    system("pause");
    return 0;



Here is some more section of the code I am trying to understand. Thank you for your responses, I understand slightly better know.

The entire program takes in scores for 3 different items for each student and then figures out the average and letter grade.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.