Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part d . What does the C function fprintf(stderr, \"This is %d, and this is %c\

ID: 3745772 • Letter: P

Question

Part d

. What does the C function fprintf(stderr, "This is %d, and this is %c ", 70, 70);

print? Where does it print it?

(6 points) 1. Write the C code to define a struct called car that contains: (character array of length 30) color tank size (double) mpg cityY mpg_hwy id (double) (double) (int) (6 points) 2. Assume the struct above has been typedef'ed, so the type car can be used instead of struct car. Assume the following code is executed. What is printed? car cl "Blue, 18.0, 24.5, 32.6, 1111; car c2 "Silver", 20.0, 18.8, 21.2, 3123) car c3c2; strcpy (c3.color, "Purple") printf ("c3 printf("c2 color: color: %s ", %s ", c3.color); c2 . color); car cp&cli cp->tank size 16.3 printf ( "c 1 tank size: %fin", c1.tank-size); Printed to screen: c3 color: c2 color: cl tank size:

Explanation / Answer

1)

struct car
{
char color[30];
double tank_size;
double mpg_city;
double mpg_hwy;
int id;
  
};

int main()
{
//creating car struct   
struct car p1 = {"Red",18.0,24.5,32.6,1111};

// Accessing structure members using structure pointer
printf("%s %lf",p1.color, p1.tank_size);
return 0;
}

/*

Output:

*/

2)Printed to Screen:

C3.color = Purple

C2.color = Silver

C1.tank_size=16.3

3)

This is 70, and this is F

since the %c is used in print statement second 70 will be taken as ASCII and respected character(%c means printing character) for 70 which is F