Question
This is a C program. In this program, a user is asked to enter an integer to specify how many numbers will be entered, then
This is a C program. In this program, a user is asked to enter an integer to specify how many numbers will be entered, then you need to allocate enough memory to store those numbers, and read each number in. The functions are then called to manipulate the array containing those numbers. USE POINTERS for all arrays to do this assignment (do not use the brackets [] syntax in this assignment). I need to do the following functions:
void tripleEach(double * array, int arraySize) - It triples each element in the array. void reverse(double * array, int arraySize) - It reverses all elements in the array. void printArray(double * array, int arraySize) - It prints all elements in the array horizontally.
#include
#include
int main()
{
int i;
double * numArray;
int size;
double num;
printf("Please enter a number of floating numbers to be entered: ");
scanf("%d", &size);
/*** Enter a line of code to allocate memory for the array here ***/
for (i=0; i { scanf("%lf", &num); //read in a double entered by user *(numArray+i) = num; } printArray(numArray, size); reverse(numArray, size); printArray(numArray, size); tripleEach(numArray, size); printArray(numArray, size); return 0; } here is an example of an output: Please enter a number of floating numbers to be entered: 5 -3.4 -6.4 4.5 -2.77 -7.26 -3.40 -6.40 4.50 -2.77 -7.26 -7.26 -2.77 4.50 -6.40 -3.40 -21.78 -8.31 13.50 -19.20 -10.20 Thanks!
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