In C/C++, it can be initialized when the array is defined:
[cpp]
view plain
copy
- int a1[3] = {1, 2, 3};
- int a2[3] = {0}; // Assign each element of the array a2 to 0.
- int a3[] = {1, 2, 3};
- char s1[3] = {'a', 'b', 'c'};
- char s2[] = "abc";
int arr[3];
arr = {10,16,8};
*Error during compilation: assigning to an array from animalizer list*/
//You cannot assign values to arrays, you can only initialize or assign values to array elements.