Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 2 - Array operations using pointers (4 marks) Exercise Objectives Pointer operations and pointer arithmetic with arrays Arrays as references Using pointers to loop

image text in transcribed
image text in transcribed
Exercise 2 - Array operations using pointers (4 marks) Exercise Objectives Pointer operations and pointer arithmetic with arrays Arrays as references Using pointers to loop through array elements Performing array operations using pointers Passing arrays to functions as references Problem Description Within replit.com IDE, create another new repl (project) and name it "Lab11Ex2". Use this project to write and run a C program that perform the following: Use the symbolic constant to define the size of the array Declare a 10 array named values of the above size Declare the following functions as prototype and implement them after the main function o ReadValues(), a function that receives an integer pointer, and an integer variable n which represents the array size. Use ONLY pointer arithmetic to read array values. o PrintValues(), a function that receives an integer pointer, and an integer variable n which represents the array size. Use ONLY pointer arithmetic to print array values o SumValue(), a function that receives an integer pointer, and an integer variable n which represents the array size. Use ONLY pointer arithmetic to get the min value of the array. o PrintinReverse(), a function that receives an integer pointer, and an integer variable n which represents the array size. Use ONLY pointer arithmetic to print array values [Hint: define another pointer variable that points to the last element then move backward with this pointer) sumEven, a function that receives an integer pointer, and an integer variable n which represents the array size. Use ONLY pointer arithmetic to find summation of even array values. In the main function: o Read values by calling ReadValues() function o Print values using PrintValues() function o Find the min element in values array by calling MinValue() o Call PrintinReverse() to print array in reverse Call AvgValues to get and print the average of array values Organize the output to appear as shown in the sample output below Download your project as zip file and keep it within your file system (Desktop for example) Upload the project to the eLearning platform Sample Output Reading array items 13 8 27 35 49 Printing array items 13 8 27 35 49 The summation is 132 Printing array items in reverse 49 35 27 8 13 sum of even array values = 8

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

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

ISBN: 0123814790, 9780123814791

More Books

Students also viewed these Databases questions