Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C Language Compile both programs with Wall. Wall shows the warnings by the compiler. Be sure it compiles on student cluster with no errors

image text in transcribed

Using C Language

Compile both programs with Wall. Wall shows the warnings by the compiler. Be sure it compiles on student cluster with no errors and no warnings.

gcc Wall arrays1.c

gcc Wall arrays2.c

2. (50 points) Write a program that adds the first and last elements of an integer array and stored as the first element of the output array, adds the second and second-to-last elements and stored as the second number, and so on. If the array has an odd number of integers, leave the central integer in the original array unchanged. Sample input/output #1: Enter the length of the array: 7 Enter the elements of the array: 3 5 8 4 1 39 Output: 128 94 Sample input/output #2: Enter the length of the array: 6 Enter the elements of the array: 2 6 13 4 1 7 Output: 9 7 17 1) Name your program arrays2.c 2) Include the following function compute() in the program: void compute(int *al, int ni, int *a2, int n2); al represents the input array with length nl, and a 2 represents the output array with length n2. The function should use pointer arithmetic-not subscripting-to visit array elements. In other words, eliminate the loop index variables and all use of the I operator in the function. 3) In the main function, ask the user to enter the length of the input array, declare the input array, calculate the length of the output array, declare the output array, call the compute function, and display the output array. Before you submit 1. Compile both programs with Wall. -Wall shows the warnings by the compiler. Be sure it compiles on student cluster with no errors and no warnings. gcc-Wall arraysl.c gcc-Wall arrays2.c

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

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions

Question

Enhance the basic quality of your voice.

Answered: 1 week ago

Question

Describe the features of and process used by a writing team.

Answered: 1 week ago