Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In programming language C, please. Write a program to find the number of elements above the average value in a file. Load the file to

image text in transcribedIn programming language C, please.

Write a program to find the number of elements above the average value in a file. Load the file to an array, compute average using the array and find the number of elements above average using the array. Use dynamic memory allocation using calloc to allocate the array and if the allocated size is not enough, use realloc to double the size of the array. Start with an array of size 10. Make sure you free the memory you allocated before you end the program. You can implement the following functions in your program. double average(double *ptr, int size) int aboveaverage(double *ptr, int size, double average) Sample execution is given below. Print a message on the screen when you allocate, reallocate and free the memory as shown below. fox01> recitation8 a. txt Allocated 10 integers Reallocated to 20 integers Reallocated to 40 integers Reallocated to 80 integers Reallocated to 160 integers 47 elements are above average of 477.455446 Dynamic array freed

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

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

Identify three types of physicians and their roles in health care.

Answered: 1 week ago