-
Notifications
You must be signed in to change notification settings - Fork 0
/
25.c
48 lines (40 loc) · 785 Bytes
/
25.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
void ScanArr(int *arr[], int a)
{
for (int i = 0; i < a; i++)
{
printf("Enter %d th Index's Value:", i);
scanf("%d", &arr[i]);
}
}
void PrintArr(const int arr[], int n)
{
for (int i = 0; i < n; i++)
{
printf("%d\t", arr[i]);
}
}
int main()
{
int x, j;
printf("Enter Array Size:");
scanf("%d", &x);
int arr[x];
ScanArr(arr, x);
int y;
printf("Enter Another Array Size:");
scanf("%d", &y);
int arr_[y];
ScanArr(arr_, y);
int arrAdd[x + y];
for (int i = 0; i < x; i++)
{
arrAdd[i] = arr[i];
}
for (int i = x, j = 0; i < x + y, j < y; j++, i++)
{
arrAdd[i] = arr_[j];
}
printf("Merged Array\n");
PrintArr(arrAdd, x + y);
}