1. Processing of Examination Marks Marks obtained by a batch of students in the Annual Examination are tabulated as follows: Student name Marks obtained S.Laxmi V.S.Rao 45 67 38 55 77 89 56 69

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
1. Processing of Examination Marks
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 Fig.11.14 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.
Transcribed Image Text:1. Processing of Examination Marks 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 Fig.11.14 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
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY