Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can sombody help me solve this? I cant figure out how to get fucntion 3 to work. everything in val_ref.c has to stay the same.

Can sombody help me solve this? I cant figure out how to get fucntion 3 to work. everything in val_ref.c has to stay the same. image text in transcribedimage text in transcribed

8 #include 9 #include 10 #include 11 #include "libsquare.h" 12 13 int square_val(int element) 14 15 1) Write two functions that square the elements in an integer array of a given size. One of the functions returns the squared value of a single element every time it is called, and the other function operates on a pointer (there is no returned value). Now, write a third function that takes in an int pointer wl point to an int array) and an int for the size of the array This third functionwi square all the elements in the given array when it is called. You must write your own libsquare.h that contains the prototypes of the three aforementioned square functions, and libsquare.c that contains the function definitions. The main source C file is given to you in a file named val ref.c to test your functions, do not change anything in this file. The following prototypes must be included in libsquare.h: return element*elementi 17 18 void square_ref(int element) int square.val(int element) void square ref (int * element); void square arr(int * array, int size); 20 kelement *element element 21 Q1-bash-80x22 23 void square_arr(int * array, int size) 24 25 26 27 28 29 30 31 libsquare.c:28:33: error: indirection requires pointer operand ('int' invalid) array[c]= (* array[c] * * array[c]); int c- 2 errors generated [Basils-MBP:q1 Basils gcc val_ref.c libsquare.c -o square libsquare.c:28:9: error: indirection requires pointer operand ('int' invalid) for(c-e ; c

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions