Given the following function definition: int myFn2(char str1[], char str2[]) {in
ID: 3817756 • Letter: G
Question
Given the following function definition: int myFn2(char str1[], char str2[]) {int 0; while (str1[i] ! = "/0' && str2[i] ! = '/0') if (str1 [i] ! = str2[i]) {return o;} ++i;} if (str1[i] == str2[i]) return 1; else return 0;} What will the following function calls return? myFn2 ("bee", cat") myFn2("owl", owl") myFn2("no", not") What would be a more meaningful name for the function myFn2? What is the purpose of the last if/else statement in the function? What is the output of the following code? void myFn3(int array[], int n) {int i; for (I = 0; IExplanation / Answer
a) myFn2("bee","cat"); -------- 0
myFn2("owl","owl"); ---------1
myFn2("no","not"); ------- 0
___________
b) As we are comparing the names the correct name for this function is compareNames() .
c) comparing the last character in the two names.
____________
4)
Output:
12
-6
2
18
-25
49
13
-5
3
19
-24
50
________________
Reason:
When we call the function for the first time myFn3() .This function will display the elements of an array .
next when we call the function myFn4() this will increment each element in the function by 1
next we are calling the function myFn3() to display the elements in the array.(It displays the modified array elements).
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.