Question: Compile with g so you can debug it Run it in gdb. Find the errors. Some of the errors you can handle within gdb by

Compile with g so you can debug it

Run it in gdb. Find the errors.

Some of the errors you can handle within gdb by setting values; other errors are logic errors that you cant fix.

Fix the errors in the .c file, recompile, until it runs correctly. In C

#include #include

struct mystruct { struct mystruct * next; int val; };

int recur (int n) { if (n == 0) return; else recur (n - 1); }

int divide (a, b) { return (a / b); }

chase (struct mystruct *p) { printf ("%d ", p-> val); chase (p-> next); }

int main () { struct mystruct *s1, *s2;

recur (5); divide (10, 5); divide (10, 0);

s1 = (struct mystruct * ) malloc (sizeof (struct mystruct)); s1->val = 1; s2 = (struct mystruct * ) malloc (sizeof (struct mystruct)); s2->val = 2;

s1-> next = s2;

chase (s1);

}

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!