I need the correct answer What is contained in the array va
Solution
int va[4] = {1,2,3,4};
int *vb;
vb = va; //vb is a pointer and points to the memory where the 1st element of the array va is stored.
(*vb)++; //(*vb) will be equal to 1 (value stored at the memory it is pointing to, which is equal to 1st element of the array). (*vb)++ would be equal to 2. Hence, va[4] = {2,2,3,4} till now
vb++; //This instruction moves the memory it is pointing to. Now, it will point to the memory of the 2nd element of the array va.
*vb = *vb+1; //Increments the value of 2nd element by 1. va[4] = {2,3,3,4}
vb++; //This instruction moves the memory it is pointing to. Now, it will point to the memory of the 3rd element of the array va.
*vb = 1; //Assigns a value of 1 to the 3rd element. va[4] = {2,3,1,4}.
Final Answer: va[4] = {2,3,1,4}.
![I need the correct answer What is contained in the array va after this C code executes? 1, 2, 4, 4 1, 2, 4, 1 2, 2, 3, 4 2, 3, 1, 4Solutionint va[4] = {1,2,3,4} I need the correct answer What is contained in the array va after this C code executes? 1, 2, 4, 4 1, 2, 4, 1 2, 2, 3, 4 2, 3, 1, 4Solutionint va[4] = {1,2,3,4}](/WebImages/21/i-need-the-correct-answer-what-is-contained-in-the-array-va-1048925-1761546029-0.webp)