Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// ./sum2 4 8 -5 0 20 // prints: Sum=27 Sum2=505 Sum3=8451 #include #include static int x; // Sum static int y; // Sum squares

// ./sum2 4 8 -5 0 20

// prints: Sum=27 Sum2=505 Sum3=8451

#include

#include

static int x; // Sum

static int y; // Sum squares

static int z; // Sum cubes

static void sum2(int argc, char *argv[]) {

TBD

}

int main(int argc, char *argv[]) {

TBD

printf("Sum=%d Sum2=%d Sum3=%d ", x, y, z);

return 0;

}

____________________________

#include

#include

typedef struct {

int x; // Sum

int y; // Sum squares

int z; // Sum cubes

} sum_t;

static sum_t *sum3(int argc, char *argv[]) {

static sum_t sum;

TBD

return ∑

}

int main(int argc, char *argv[]) {

sum_t *m;

TBD

printf("Sum=%d Sum2=%d Sum3=%d ", m->x, m->y, m->z);

return 0;

}

-----------------------------------------------

#include

#include

typedef struct {

int x; // Sum

int y; // Sum squares

int z; // Sum cubes

} sum_t;

static void sum4(int argc, char *argv[], sum_t *sum) {

TBD

}

int main(int argc, char *argv[]) {

sum_t m;

TBD

printf("Sum=%d Sum2=%d Sum3=%d ", m.x, m.y, m.z);

return 0;

}

You have been given C files, each has the same logic, expressed in different ways. Each of the files is incomplete, marked by TBD. You must replace each TBD entry with appropriate C code. You must NOT alter any of the existing lines. You are only allowed to replace each TBD line with new lines.

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_2

Step: 3

blur-text-image_3

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

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions