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.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 16PE
icon
Related questions
Question

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.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr