Question
The following is in C: Given the code below, please answer the questions (below the code)-- I know there is a lot of code, but
The following is in C:
Given the code below, please answer the questions (below the code)-- I know there is a lot of code, but there are only 4 relevant questions about the code.
}
35
36
a) The first call to gfind_max is valid, and produces the expected result, however, the following three calls are invalid, producing 0xfffff, 0x44 (or 'D'), and 0x90000 respectively. I understand why 0xfffff is produced, but not the latter two, how does the char comparison reach 0x44 (my initial thought was overflow? But I was unable to decide which value it ultimately caster to be the max char in the first place). The last one compares them as char*s, (I assume to compare the pointers, but I don't know why you would want to compare them since it's just comparing the addresses I assume), why are the last two calls invalid, and why are they producing these results?
b) If you run the code as is--it works. but if you change the code to use cmp_first_char for both sort and search, when will your code crash (and why?)?
(c and d see image below)
1 #includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started