subject

Write a program that dynamically allocates an array of integers. The size of the array (the number of integers, not the byte size) should be read from the user using scanf(). You may assume that the user will input a positive integer (i. e., don't do error checking). The elements of the array should be filled using random() function. After filling the array with random numbers, your program should then make a copy of the array, and sort the new array in ascending order: that is, the first entry of the array should contain the smallest integer in the array, while the last entry should contain the largest integer in the array. Then make a second copy of the original array, and sort it in descending order. Finally your program should print out all three arrays. All three arrays should be separately allocated using malloc() library function. Don't forget to call free() to deallocate the arrays.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:30
Write a function called checkfactor that takes two arrays of positive numbers, firstnumberrow and secondnumberrow. checkfactor checks if the first entry in firstnumberrow is divisible by the first entry in secondnumberrow, and performs the same operation on the next array elements until all entries have been checked. all the numbers are positive and the number of entries in the arrays are the same. the function should return the identified divisible numbers in two row arrays named firstdivisible and seconddivisible.restrictions: branches or loops should not be used. the code must use the internal mod and logical functions.hint: the mod function should be used to determine if two numbers are divisible. ex: for num1 and num2 if mod(num1,num2) is 0, then the two numbers are divisible.this is matlab
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
20 points archie wants to use a reflector as he photographs a newlywed couple. what would he consider in his choice? a. shadow and sunny b. homemade and professional c. lamps and boards d. incident and reflected e. neutral density and enhancement
Answers: 3
question
Computers and Technology, 23.06.2019 23:30
Match the following errors with their definitions. a. #name b. #value c. #ref d. 1. when a formula produces output that is too lengthy to fit in the spreadsheet cell 2. when you enter an invalid cell reference in a formula 3. when you type text in cells that accept numeric data 4. when you type in a cell reference that doesn’t exist
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
What can you prevent issues related to downloading content form the internet
Answers: 1
You know the right answer?
Write a program that dynamically allocates an array of integers. The size of the array (the number o...
Questions
question
Chemistry, 24.01.2021 14:00
question
Mathematics, 24.01.2021 14:00
question
Biology, 24.01.2021 14:00
question
Mathematics, 24.01.2021 14:00
question
Chemistry, 24.01.2021 14:00
question
English, 24.01.2021 14:00
Questions on the website: 13722363