Queenkay7481 Queenkay7481
  • 23-07-2020
  • Computers and Technology
contestada

Write a C function check(x, y, n) that returns 1 if both x and y fall between 0 and n-1 inclusive. The function should return 0 otherwise. Assume that x, y and n are all of type int.

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 24-07-2020

Answer:

See comments for line by line explanation (Lines that begins with // are comments)

The function written in C, is as follows:

//The function starts here

int check(x,y,n)

{

//This if condition checks if x and y are within range of 0 to n - 1

if((x>=0 && x<=n-1) && (y>=0 && y<=n-1))

{

//If the if conditional statement is true, the function returns 1

 return 1;

}

else

{

//If the if conditional statement is false, the function returns 0

 return 0;

}

//The if condition ends here

}

//The function ends here

Explanation:

Answer Link

Otras preguntas

Penny says that the expression 8(3x - 2) is equivalent to the expression 11x - 10. Is Penny correct?
Pls help w this spanish!! Please use the right abbreviations , you may have to zoom in <3
Please help No links please
ANSWER PLSDONT SEND A LINK IF U DO I WILL REPORT U​
Hugh, a self-employed individual, paid the following amounts during the year: Real estate tax on Iowa residence $3,800 State income tax 1,700 Real estate taxes
opulation 500 Population over age 16 400 Persons employed full-or part-time 200 Persons unemployed and actively seeking work 20 Persons who have quit seeking wo
please help!!!!!!!!!!!!!!11
help QUICK! i need to finish!
Charles Darwin proposed the theory of evolution through the mechanism of natural selection. In order for natural selection to occur, Darwin hypothesized that al
what were 2 reasons people joined the crusades