Explanatory Question
What is an array in C?
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.
An Array is a group of similar types of elements. It has a contiguous memory location. It makes the code optimized, easy to traverse and easy to sort. The size and type of arrays cannot be changed after its declaration.
Arrays are of two types:
Syntax:
Syntax:
#include int main() { int arr[5]={1,2,3,4,5}; //an array consists of five integer values. for(int i=0;i<5;i++) { printf("%d ",arr[i]); } return 0; }
1 2 3 4 5
First read the answer fully, then try to explain it in your own words. After that, open a few related questions and compare the concepts. This method helps you remember the topic for a longer time and improves exam preparation.