Parameters and the number of elements of the arrays

Assignment Help Basic Computer Science
Reference no: EM132132577

***C PROGRAMMING***

Need help with a C program array_rearrange.c that rearranges an integer array. The array will be split into two sets of integers one by one. A new array will be created by append the first set to the second set. For example, an integer array {1, 2, 3, 4, 5, 6} will be split into two sets of integers: 1, 3, 5 and 2, 4, 6. Merging result: {2, 4, 6, 1, 3, 5}. Note that the two sets do not necessarily have the same length (when the array has even number of elements). When the input word has odd number of elements the first set will be one element more than the second set. For example, the result of rearranging an integer array {1, 2, 3, 4, 5} will be {2, 4, 1, 3, 5}. Your program should include the following function: void rearrange(int *a1, int n, int *a2); 

The function should use pointer arithmetic - not subscripting - to visit array elements. The rearrange function merges the two sets of integers by appending the first set to the second set and store the result in the second array a2. The function takes an int array parameters a1 and 2 as the first parameter and third parameters and the number of elements of the arrays as the second parameter.  

Example I/O:

Enter the length of the array: 5 

Enter the elements of the array: 9 8 5 6 4 

Output: 8 6 9 5 4

Reference no: EM132132577

Questions Cloud

Identify one form of trauma in the given situation : Identify one form of trauma that you feel would make it difficult for you to tolerate or ‘bear witness to' in your role as a social worker.
Prepare a response to case studies : Please prepare a response to case studies offered related to situation/scenarios faced by case managers and counselors. Please utilize your course textbook.
Discuss a time in your work life when you needed : Discuss a time in your work life when you needed to use critical thinking. How would you show a potential employer that you have solid critical thinking skills
Compute the amount of funds bragg needs to borrow for june : Lois Braggs owns a small restaurant in Boston. Required: Compute the amount of funds Ms. Bragg needs to borrow for June
Parameters and the number of elements of the arrays : The function should use pointer arithmetic - not subscripting - to visit array elements. The rearrange function merges the two sets of integers by appending
Design the structure of your new center : Analyze the key components of three (3) sources of law related to the effects that each source could potentially have on your healthcare.
What strategies might you use to apply : As you read the resources this week, what concepts seem especially relevant to you as a social worker? Are you able to identify any personal misunderstandings.
Extract function finds the positive numbers : The extract function finds the positive numbers in the array a and store in array positive. The third parameter is array of positive
Cause and effect relationships that bear on risk events : Project managers can identify risks by learning and understanding the cause and effect relationships that bear on risk events.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Find out what the inherit properties button on the hatch

Find out what the Inherit Properties button on the Hatch and Gradient dialog box does. Explain how it can save you time when you create a complex drawing that has several hatched areas.

  Definition of control classes

It is required to develop an application in Java for Student Registration System(SRS) for a university that provides on line degree programs.

  Personal computer in good operational control

What good practices do you follow to maintain your laptop or personal computer in good operational control, particularly when you upload or download

  Do the rules lead to the same possible executions

It is possible to write an if statement in terms of a case statement. How? This implies that case could have been put in the kernel language instead of if, and if could have been defined as a linguistic abstraction.

  Processes of human beings

What is the name of the computer program that simulates the thought processes of human beings?

  Describe how each method is used for a different purpose

Discuss specific situations when you would use CIDR, summarization, and VLSM. Each method used all involves moving the network/node line to the right or to the left. Describe how each method is used for a different purpose.

  Operations performed on any linear structure

State and explain any six operations performed on any linear structure?

  Create at least six screens representing various states

Make the purpose small and achievable. For example, imagine an application that constantly keeps you updated on what is happening in the class, with classmates posting and commenting on your work and assignments. Be sure to explain the purpose of ..

  Electronically through an automated teller machine

1. You should reconcile your bank account immediately after you receive your statement.

  What happens when each schedule is run by a scheduler

Tell what happens when each schedule from (iii) is run by a scheduler that supports shared locks, exclusive locks, and upgrading.

  What are the characteristics of relationships

What are the characteristics of relationships, normalization, and keys and dependencies?

  What is the probability that he will not have to pay

What is the probability that he will not have to pay for the DVD players?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd