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

will give a thumbs up if answer all questions uiz Instructions 80 minute exam Ex

ID: 3707103 • Letter: W

Question

will give a thumbs up if answer all questions uiz Instructions 80 minute exam Exam may NOT be stopped and restarted Try to answer all questions, partial credit will be given when necessary You can assume the following libraries and functions are available for all questions on the exam: #includes stdioh» ,printf and scanf ? #includesctypeh> rolower and toupper · You do not need to write a complete program unless the question asks for a complete program e read each question carefully Question 1 Write the function prototype for a function called Averagelt which has four arguments/ parameters,three integers and a double pointer. The function adds the first three values, calculates their average and stores the result in the "value at" the fourth argument MacBook Air s11 K. ck

Explanation / Answer

Ques 1.

void Averagelt(int x, int y, int z, double *average)

{

    int sum = x + y + z;

   

    // calculate average

    *average = (double)sum / 3.0;

}

Ques 2.

void CompareCharacters( char ch1, char ch2 , int *ptr )

{

    // get the ascii value of both characeters

    int ascii1 = (int)ch1;

    int ascii2 = (int)ch2;

   

    // if both are same

    if( ascii1 == ascii2 )

        *ptr = 0;

    else if( ascii1 < ascii2 )

        *ptr = 1;

    else

        *ptr = 2;

}

Ques 3.

void NumberGrade(double *ptr , char ch1, char ch2)

{

    // create array of size 2

    ptr = (struct double *)malloc( 2 * sizeof(double) );

   

    ptr[0] = ch1;

    ptr[1] = ch2;

}

Ques 4.

double scoreList[50];

printf("Enter a value : ");

double x;

// get user input

scanf("%lf", &x);

scoreList[1] = x;

printf("Enter another value : ");

// get user input

scanf("%lf", &x);

scoreList[49] = x;