Use Functions and dynamic array in C programming?

Write a program that processes student grade data for a few courses.

- The number of courses and the number of student for each course must be given from the user. Note that the number of students in each course can be different.

- The program finds the average, the minimum and the maximum grade for each course and prints them. You can use the above three functions to find those numbers. The program also prints the overall average.

- You should not use any fixed-size array variable. You should use dynamic memory allocation. Here is an example of daynamic memory allocation.

#include <stdlib.h> // for malloc(), free(), ...

double *grade; // dynamic double array variable?

int num, i;

printf(“Enter the number of students: “);

scanf(“%d”, &num); // the number of student

grade = (double *)malloc(sizeof(double) * num); // alocate memory space

// Now grade is like an array // for num double variables?

for (i = 0; i < num; i++)

scanf(“%lf”, ...); // the address of the ith grade ???


2 Answers

  • 9 years ago
    Favorite Answer

    what is your question actually.

  • Anonymous
    9 years ago

    we can used dynamic array in C programming is possible.

Still have questions? Get your answers by asking now.