Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago