Question: 1 . ( 6 points ) Consider the code below: 1 # include < stdio . h > 2 # include < stdlib . h
points Consider the code below:
# include stdio h
# include stdlib h
struct dbentry
char name ;
char value ;
;
void dbeprint struct dbentry entry
fprintf stdout s s
entry name entry value ;
int main int argc char argv
struct dbentry e ;
e name hocus pocus ;
e value focus ;
dbeprint e ;
return ;
This code compiles, but crashes when it is run. Suspecting a problem with dbe print,
you comment out the line of code that prints the entry however the program still
crashes! You suspect the crash is caused by a memory allocation problem.
a What is the reason for the crash?
January Page
CSSE Winter
b Without changing existing code, you can solve this problem by inserting additional
code to correct the crash and resolve the memory issue.
Indicate what code you would insert and the line numbers immediately before
where your code will be inserted. For example, insert this code after line or
insert this code just above line
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
