1int size=5;
2int array[size]; // array of size=5;
3
4for(i=0;i<size;i++){
5 scanf("%d",&array[i]);
6 }
1#include <stdio.h>
2int main(void)
3{
4int size, i;
5printf("Enter the size of the arrays:\n");
6scanf("%d", &size);
7
8int arr1[size];
9printf("Enter the elements of the array:\n");
10for (i = 0; i < size; i++) {
11 scanf_s("%d", arr1[size]);
12}
13printf("The current array is:\n %d", arr1[i]);
14}
1// Syntax:
2datatype_variable[dimension] = new datatype[size]{array};
3
4// For example:
5string MyArray[] = new string[1]{"Hello","World"};
6
7// or just:
8string MyArray[]={"Hello","world"};
9
10// for multidimensions:
11// 2D array:
12 // 2 arrays, 3 values //
13int MyArray=[,]=new int[1,2]{
14 {1,2,3},
15 {1,2,3}
16}
17
18// 3D array:
19 // 2 arrays, 3 arrays, 4 values //
20int MyArray=[,,]=new int[1,2,3]{
21 {
22 {1,2,3,4},
23 {1,2,3,4},
24 {1,2,3,4}
25 },
26 {
27 {1,2,3,4},
28 {1,2,3,4},
29 {1,2,3,4}
30 }
31}