Marks obtained by a batch of students in the Annual Examination are tabulated as follows: Student name Marks obtained S.Laxmi XXXXXXXXXX V.S.Rao XXXXXXXXXX - - - - - - It is required to compute the...


Marks obtained by a batch of students in the Annual Examination are tabulated as follows:
Student name Marks obtained
S.Laxmi 45 67 38 55
V.S.Rao 77 89 56 69
- - - - - -
It is required to compute the total marks obtained by each student and print the rank list based on
the total marks.
The program in below figure stores the student names in the array name and the marks in the
array marks. After computing the total marks obtained by all the students, the program prepares
and prints the rank list. The declaration
int marks[STUDENTS][SUBJECTS+1];
Defines marks as a pointer to the array's first row. We use rowptr as the pointer to the row of
marks. The rowptr is initialized as follows:
int (*rowptr)[SUBJECTS+1] = array;
Note that array is the formal argument whose values are replaced by the values of the actual
argument marks. The parentheses around *rowptr makes the rowptr as a pointer to an array of
SUBJECTS+1 integers. Remember, the statement
int *rowptr[SUBJECTS+1];
would declare rowptr as an array of SUBJECTS+1 elements.
When we increment the rowptr (by rowptr+1), the incrementing is done in units of the size of
each row of array, making rowptr point to the next row. Since rowptr points to a particular row,
(*rowptr)[x] points to the xth element in the row.



Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here