Posts

Showing posts from October 9, 2022

Array in C Programming | C Programming

Image
Array in C Array in C Programming The C language provides a capability that enables the user to define a set of ordered data items known as an array. Suppose we had a set of grades that we wished to read into the computer and suppose we wished to perform some operations on these grades, we will quickly realize that we cannot perform such an operation until each and every grade has been entered since it would be quite a tedious task to declare each and every student grade as a variable especially since there may be a very large number. In C we can define a variable called grade, which represents not a single value of grade but an entire set of grades. Each element of the set can then be referenced by means of a number called an index number or subscript. Declaration of arrays Like any other variable arrays must be declared before they are used. The general form of declaration is: type variable-name [50]; The type specifies the type of the elements that will be contained in the array,