Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions