Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can anyone help PAR and M Allocated (20 pts) In this assignment, you'll dynamically allocate memory for a number of integer variables to be read

can anyone help

image text in transcribed

PAR and M Allocated (20 pts) In this assignment, you'll dynamically allocate memory for a number of integer variables to be read from the keyboard You'll be able to sort the elements read into that dynamic storage. You'll also be able to change the value of a particular element. You need to implement the following steps in the test file (SortModifyArray test.c). Stepl: You need to dynamically allocate memory to read into a number of elements. As you see in the attached test file, 'i' is an integer pointer which needs to dynamically allocate memory to read a number of integers into it from allocate keyboard. a iateger pojater 5 pts 2 pts nf. Step 2: Read n numbers into the allocated block using sca Step 3: Next, the elements in need to be sorted using sort function, ie, sort(n). In 'sortArray, function, you need to use the function 'swapElements' that swaps two array elements. You need to implement swapElements function Addresses of two array elements will be passed explicitly in swapElements. Step 4: Now, you should be able to change the value of an element for a particular index in 'x'; You need to implement changeElements function changeElements function must receive the address of an argument to modify an array element, that particular element should be nmltiplied by 2. Step 5: The array may need to be sorted again after a particular element has been changed. So, you need to sort the aray again Step 6: You're done. Now, free the Here'sis a screen shot how your output will look like once you implement all the steps: 6 pts 4 pts memory allocated for i 2 pts the sorted atray mere i3 ce aEay with a particular array elewat changed: 5x-16

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

Students also viewed these Databases questions