The trouble is you think you have time. Your success depends on how you utilize your time.

Dry Run Practice Program # 2

What are the values assigned to these index (arr[0], arr[1], arr[2], arr[3]) of the following code:

#include<iostream>
using namespace std;
int main()
{
int arr[4];
for(int i=0;i<4;i++)
if(i%2==0)
arr[i]=2*i;
else
arr[i]=i;

return 0;
}

For the answer with explanation that how it worked CLICK HERE.

1 comment: