Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in C Programming by (55.6k points)
recategorized by
Can anyone explain what is an array in C?

1 Answer

0 votes
by (119k 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 Programming Online 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

Browse Categories

...