Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that initializes an array-of-double and then copies the contents

ID: 3621375 • Letter: W

Question

Write a program that initializes an array-of-double and then copies the contents of the array into two other arrays. (All three arrays should be declared in the main program.) To make the first copy, use a function with array notation. To make the second copy, use a function with pointer notation and pointer incrementing. Have each Function take as arguments the name of the target array and the number of elements to be copied. That is, the function calls would look like this, given the following declarations:

double source[5] = {1.1, 2.2, 3.3, 4.4, 5.5};
double target[5];
double target[5];
copy_arr(source, target1, 5);
copy_ptr(source, target1, 5);

Design and test a function that searches the string specified by the first function parameter for the first occurrence of a character specified by the second function parameter. Have the function return a pointer to the character if successful, and a null if the character is not found in the string. (This duplicates the way that the library strchr() function works.) Test the function in a complete program that uses a loop to provide input values for feeding to the function.

Note that if the function does not find the character, it should return a NULL pointer, not a pointer to a NULL character.

Explanation / Answer

Dear.. #include #define item 5 double source[item] = {1.1, 2.2, 3.3, 4.4, 5.5}; double T1[item] = {0.0}; double T2[item] = {0,0}; void copy_arr(double [], double [], int); void copy_ptr(double *, double *, int); void print_results(void); int counter; int main(void) { printf("BEFORE calling functions "); print_results(); copy_arr(source, T1, item); copy_ptr(source, T2, item); printf("AFTER calling functions "); print_results(); return 0; } void copy_arr(double source[], double target[], int items) { for (counter = 0; counter
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote