Question: You can assume the code given is from working code. Answer the true/false questions that follow. You MUST explain why your answer is true or

You can assume the code given is from working code. Answer the true/false questions that follow. You MUST explain why your answer is true or false to receive credit.

char present_num(int **all_nums, int size, int num_to_find)

{

char answer='n'; int i; for(i=0;i

if(**all_nums==num_to_find) {

answer='y'; }

all_nums++; }

return answer;

}

int same_stuff(int* x_arr[]) {

if(*x_arr[0]==*x_arr[1]) {

return 1; }

else {

return 0; }

}

  1. Only one type of unary operator is used in the code.

  2. sizeof(x_arr[0])==sizeof(*x_arr[0])

  3. sizeof(x_arr)==sizeof(all_nums)

  1. The for loop will not always iterate the same number of times.

  2. all_nums++; will move the pointer ahead 4 bytes (the size of an int on my machine).

  3. The function same_stuff will return 1 if the values held in index 0 and 1 of x_arr are equal.

  4. num_to_find=**all_nums; would be a valid line of code.

  5. same_stuff will return 0 for all cases except for one.

  6. If the value of num_to_find is found to match an element of all_nums, the value of answer will be y.

10. int* ptr= *x_arr[0]; would be a valid line of code.

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!