In C language, an array cannot be copied to another array directly by assignment operator.
int arr1[]={1,3,2}; int arr2[]={0}; arr2=arr1;//not possible Also, we cannot assign values to an array that is already defined, if I am not wrong...
int a[3]; a[]={1,3,2}; //this is not possible In the code above, a[] and {1,3,2} act as two different arrays, and an assignment operator is used between them. So, is this following the same case mentioned at the first?
Please clarify. Thanks.
arr1andarr2are 1D arrays), but a single element. This is very well possible. Please clarify your question. From a wrong prerequisite, everything can be deduced.memsetormemcpywill help you to achieve the same thing though:memcpy(arr1, arr2, sizeof arr1/sizeof *arr1);or something