Question: int main() { int input_array[5]; int n; int* output_arrayp; printf(Enter 5 values separated by spaces> ); scanf(%d%d%d%d%d,&input_array[0],&input_array[1],&input_array[2],&input_array[3],&input_array[4]); printf(Enter the value of n> ); scanf(%d,&n); printf(Input

int main() { int input_array[5]; int n; int* output_arrayp; printf("Enter 5 values separated by spaces> "); scanf("%d%d%d%d%d",&input_array[0],&input_array[1],&input_array[2],&input_array[3],&input_array[4]); printf("Enter the value of n> "); scanf("%d",&n); printf("Input array is: %d %d %d %d %d ",input_array[0],input_array[1],input_array[2],input_array[3],input_array[4]); output_arrayp=output(input_array, n); printf("Output array is: %d %d %d %d %d",*(output_arrayp),*(output_arrayp+1), *(output_arrayp+2), *(output_arrayp+3), *(output_arrayp+4));

return 0; }

int* output(int input_array[5], int n) { int output_array[5]={pow(input_array[0],n), pow(input_array[1],n), pow(input_array[2],n), pow(input_array[3],n),pow(input_array[4],n)}; return output_array; }

I'm trying to pass an array to a function which increases the size of every element in the array to the power of n.This function is then called in the main. For some reason i cannot get it to work. I HAVE to do this using a fuction. Is there a way to pass the input_array to the function and get the output_array? Could someone explain why this isnt working and how i can make it work.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!