Question: In C language Implement the function join_arrays that gets three integer arrays and size of the three arrays as its arguments. The six function arguments
In C language
Implement the function join_arrays that gets three integer arrays and size of the three arrays as its arguments. The six function arguments should be in this order:
- number of integers in the first array (as unsigned integer)
- pointer to first array of integers
- number of integers in the second array (as unsigned integer)
- pointer to second array of integers
- number of integers in the third array (as unsigned integer)
- pointer to third array of integers
The function should join the three arrays into a single array that contains all integers from the original arrays in the above order. The new array should be allocated dynamically, and the function should return the pointer to the created array. You must not modify the original arrays.
Heres an example main - function, which can be used to test your program:
int main(void) { /* testing exercise. Feel free to modify */ int a1[] = { 1, 2, 3, 4, 5 }; int a2[] = { 10, 11, 12, 13, 14, 15, 16, 17 }; int a3[] = { 20, 21, 22 }; int *joined = join_arrays(5, a1, 8, a2, 3, a3); for (int i = 0; i < 5 + 8 + 3; i++) { printf("%d ", joined[i]); } printf(" "); return 0; } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
