1.

Suppose you are given Total mark of 50 students in a class 1. How will you store these values using ordinary variable? 2. Is there any other efficient way to store these values? Give reason.

Answer»

We have to declare 50 variables individually to store total marks of 50 students. It is a laborious work. 

Hence we use array, it is an efficient way to declare 50 variables. With a single variable name we can store multiple elements.

eg: int mark[50]. 

Here we can store 50 marks. 

The first mark is in mark[0], second is in mark[1]…. etc the fiftieth mark is in mark[49],



Discussion

No Comment Found

Related InterviewSolutions