Marks obtained by a batch of students in the Annual Examination are tabulated as follows:Student name Marks obtainedS.Laxmi 45 67 38 55V.S.Rao 77 89 56 69- - - - - -It is required to compute the total marks obtained by each student and print the rank list based onthe total marks.The program in below figure stores the student names in the array name and the marks in thearray marks. After computing the total marks obtained by all the students, the program preparesand prints the rank list. The declarationint marks[STUDENTS][SUBJECTS+1];Defines marks as a pointer to the array's first row. We use rowptr as the pointer to the row ofmarks. 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 actualargument marks. The parentheses around *rowptr makes the rowptr as a pointer to an array ofSUBJECTS+1 integers. Remember, the statementint *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 ofeach 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.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here