Tagged: array 1D learn

C Arrays – 1D (1 Dimensional) 29

C Arrays – 1D (1 Dimensional)

An array in C is a collective name given to a group of similar variables. C arrays can be 1-Dimensional, 2-Dimensional, 3-Dimensional and so on. In this topic, we will discuss 1-Dimensional (1D) arrays in C. So lets start with 1D array in C. Let us understand C arrays with the help of an example. void main(){ int arr[3],i; printf(“Enter 3 values\n”); for(i=0;i<3;i++) { scanf(“%d”,&arr[i]) } printf(“The entered values are:\n”); for(i=0;i<10;i++) { printf(“%d\t”,arr[i]) } } Explanation: int arr[3] statement declares an array capable of holding 3 integer values. The first value can be accessed using arr[0]. Similarly second value can...