C Program Calloc Write a program that asks for two integers X and Y as input and creates two arrays with sizes X and Y using calloc. Then, ask for the elements of the two arrays using a loop of your preference and concatenate the two arrays into one. Elements in X must come first. One line containing an integer for the size of the array X Print the concatenated elements inside a pair of square brackets [ ] where each elements are separated by a comma and a space. At the end of the program, don't forget to free the memory space. Input 1. One line containing an integer for the size of the array X 2. One or more lines containing an integer for the elements of array X 3. One line containing an integer for the size of the array Y 4. One or more lines containing an integer for the elements of array Y Output Enter size of array 1: 3 Enter element 1: 1 Enter element 1: 2 Enter element 1: 3 Enter size of array 2: 2 Enter element 1: 4 Enter element 1: 5 [1, 2, 3, 4, 5]
C Program Calloc
Write a program that asks for two integers X and Y as input and creates two arrays with sizes X and Y using calloc.
Then, ask for the elements of the two arrays using a loop of your preference and concatenate the two arrays into one. Elements in X must come first. One line containing an integer for the size of the array X
Print the concatenated elements inside a pair of square brackets [ ] where each elements are separated by a comma and a space.
At the end of the program, don't forget to free the memory space.
Input
1. One line containing an integer for the size of the array X
2. One or more lines containing an integer for the elements of array X
3. One line containing an integer for the size of the array Y
4. One or more lines containing an integer for the elements of array Y
Output
![2. Dynamic Memory Allocation Practice II
by CodeChum Admin
Write a program that asks for two integers X and Y as input and creates two arrays with
sizes X and Y using calloc.
Then, ask for the elements of the two arrays using a loop of your preference and
concatenate the two arrays into one. Elements in X must come first. One line containing an
integer for the size of the array X
Print the concatenated elements inside a pair of square brackets [] where each elements
are separated by a comma and a space.
At the end of the program, don't forget to free the memory space.
Input
1. One line containing an integer for the size of the array X
2. One or more lines containing an integer for the elements of array X
3. One line containing an integer for the size of the array Y
4. One or more lines containing an integer for the elements of array Y
Output
Score: 0/10
main.c
+16
C
Test Cases
O Constraint 1
This code must use calloc function.
O Constraint 2
This code must use free function.
Test Cases
O Test Case 1
Your Output
No Output
Expected Output
Enter size of array 1: 3
Enter element 1: 1
Enter element 2: 2
Enter element 3: 3
Enter size of array 2: 2
Enter element 1: 4
Enter element 2: 5
[1, 2, 3, 4, 5]](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F47d062c1-c957-4532-a26c-3b51af227978%2F29be9167-923e-4223-84e8-04b46090eaf6%2F9siz1b8_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 4 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)