c programming array code example
Example 1: array value from user c
#include <stdio.h>
int main(void)
{
int size, i;
printf("Enter the size of the arrays:\n");
scanf("%d", &size);
int arr1[size];
printf("Enter the elements of the array:\n");
for (i = 0; i < size; i++) {
scanf_s("%d", arr1[size]);
}
printf("The current array is:\n %d", arr1[i]);
}
Example 2: array loop in c
int i, array[5]= {1, 2, 3, 4, 5};
for(i=0 ; i<5 ; i++)
{
printf("%d", array[i]) ;
}
Example 3: c program for array
int arr1[10];
int n = 10;
int arr2[n];
Example 4: array of array in c
int a[3][4] = {
{0, 1, 2, 3} ,
{4, 5, 6, 7} ,
{8, 9, 10, 11}
};