Array in C
An array is a variable that can store multiple values of same data type.
For example, if we want to store 100 integer numbers, we can create an array.
How to declare an Array?
An array is declared by using Data Type
,
Array Name
, and
Array Size
Syantx of Array Declaration
Example
How to access array elements?
We can access elements of an array by indexes.
Suppose we declared an array num[100]
as
above. The first element is num[0]
, the second
element is num[1]
, the third element is
num[2]
, and so on.
How to initialize an array?
An array can be initialized during declaration as
Here
Here a simple program that takes input from user and store it in an Array and then prints the elements stored in Array.
Program
Output
Join Our Social Media Connections
0 Comments