Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PART 2 GDB Program etox.c should approximate ex but has an error that makes it execute incorrectly. First, simply compile and run the program to
PART GDB
Program etox.c should approximate ex but has an error that makes it execute incorrectly. First, simply compile and run the program to observe the incorrect behavior, then recompile it to support debugging with gdb and use the gdb commands to identify the source of the incorrect behavior. Lastly, fix the errors and run the program to observe the correct behavior. Record all the gdb activity.
Etox.c file:
#include
double getvalue double int;
int factorial int;
int main
int n;
double x;
double series;
printfThis program calculates ex
;
printfusing sum of xkk
;
printfEnter x n : ;
scanflfd&x&n;
printfxn lf d
xn;
series getvaluexn;
printfex lf
series;
return;
double getvalue xn
double x;
int n;
int k;
double value ;
double xpow ;
for k ; k n; k
value xpow factorialk;
xpow xpow x;
returnvalue;
int factorial number
int number;
int j;
int fact ;
for j ; j number; j
fact fact j;
returnfact;
Step 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