Presentation is loading. Please wait.

Presentation is loading. Please wait.

Arrays in C The c language provides a capability that enables the user to design a set of similar data types called array. Pointers and arrays are.

Similar presentations


Presentation on theme: "Arrays in C The c language provides a capability that enables the user to design a set of similar data types called array. Pointers and arrays are."— Presentation transcript:

1 Arrays in C The c language provides a capability that enables the user to design a set of similar data types called array. Pointers and arrays are closely related because all arrays make use of pointers internally.

2 Arrays description For understanding the arrays properly, let us consider the following example. main() { int x; X=5; X=10; Printf(“\nx=%d”,x); }

3 Continued.. In above example output will be 10 as x is assigned to 10,but previous value i.e. 5 is lost. Ordinary variables are capable of holding only one value at a time. There are many situation in which we would want to store more than one value at a time in a single variable.

4 Example Array Suppose we wish to arrange percentage of marks obtained by 100 students in ascending order. In this case construct one variable (arrays)capable of holding or storing all the hundred values. An array is a collective name given to group of similar quantities(these could be percentage marks of 100 students, salaries of 300 employees).

5 Thank you

6 Continued.. What is important is that the quantities must be “similar”. Per={48,88,23,96}. Thus an array is a collection of similar elements,these similar elements could be all ints,or all floats,or all chars.etc.


Download ppt "Arrays in C The c language provides a capability that enables the user to design a set of similar data types called array. Pointers and arrays are."

Similar presentations


Ads by Google