Write a program that contains the following

Write a program that contains the following

  1. Write a function copies with two int parameters, named n and x. It should dynamically allocate a new array of size n.  The function should then copy the value in x to every position in the array. The function should return a pointer to the new array.
  2. In the main function, call the copies function from part 1. with size 5 and value -1.  Output the resulting array to the screen, and deallocate the array.
  3. In your main function, add code to declare and initialize two integer variables y and z to 10 and 3.  Then call the function increment which has the prototype below.  The call should result in incrementing the value in y by z (so y will become 13).
void increment (int *a, int b); //do NOT define this function
// this function adds b to the value pointed to by the first argument

Looking for a similar assignment? Get help from our qualified experts!

Order Now

Don't use plagiarized sources. Get Your Custom Essay on
Write a program that contains the following
Just from $8 /Page 0r 300 words
Order Now