Question: int moveRobots ( int * arg 0 , int * arg 1 , int arg 2 , int arg 3 ) { int i ,

int moveRobots(int *arg0, int *arg1, int arg2, int arg3)
{
int i,*ptrX,*ptrY, alive =1;
ptrX = arg0;
ptrY = arg1;
for (i=0;i<4;i++){
*ptrX = getNew(*ptrX,arg2); // update x-coordinate of robot i
*ptrY = getNew(*ptrY,arg3); // update y-coordinate of robot i
// check if robot caught user
if ((*ptrX == arg2) && (*ptrY == arg3)){
alive =0;
break;
}
ptrX++;
ptrY++;
}
return alive;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!