What happened when we try to copy the array arr1 into the array-01003
This subjective question is related to the book/course vu cs605 Software EngineeringII. It can also be found in vu cs605 Mid Term Solved Past Paper No. 3.
Question 1: What happened when we try to copy the array 'arr1' into the array 'arr2' in the following code segment, justify your answer?
main() {
int arr1[3]={2,3,5};
int arr2[3];
arr2=arr1;
}
main() {
int arr1[3]={2,3,5};
int arr2[3];
arr2=arr1;
}
Answer:
We can not copy array directly in this way (arr2=arr1;)
Each member of arr1 to be copied by each member of arr2.
We can use for loop to copy array 1 to array2