Answered step by step
Verified Expert Solution
Question
1 Approved Answer
AND PLEASE ANSWER Q2. swap2.s void swap (int *px, int *py) { int *temp; *temp = *px; *px = *py; *py = *temp; } (Exercise)
AND PLEASE ANSWER Q2.
swap2.s
void swap (int *px, int *py) { int *temp; *temp = *px; *px = *py; *py = *temp; }
(Exercise) Create swap.c Supply the definition of a C procedure proc to be called in the main program immediately prior to the call to the buggy swap (swap2.s) that will guarantee that swap will crash when the uninitialized temp pointer is dereferenced (it should cause a crash on temp). Also explain why your call guarantees this crash. Hint: your proc procedure will leave something on the stack. int main int a - 1, b- 2; proc(/* Some args might go here */); swap (&a, &b) Q2. Explain how you guarantee it crashing with what is in procStep 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