0 votes
1 view
in C Programming by (36k points)
recategorized by
Can anyone explain what is an array in C?

1 Answer

0 votes
by (86.8k points)

Arrays a kind of data structure to store multiple homogenous elements. Arrays are mutable i.e we can modify after creating an array.

Declaring Arrays

To declare an array in C, you have to specify the data type of the elements and the number of elements can be stored in an array as follows −

type arrayName [ arraySize ];

Example:

double balance[10];

Initializing Arrays

You can initialize an array in C in a single statement as shown below −

double balance[5] = {250.0, 2.0, 3.4, 17.0, 450.0};

 Accessing Arrays:

An element of an array can be accessed by indexing as follows:

double salary = balance[9];

If you want to learn C programming, then check out this C Language Course by Intellipaat.

Also, watch this YouTube tutorial on C programming: 

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...