#include<stdio.h>
#include<stdlib.h>
int main(void)
{
// array number 1
int arr1[] = {1,2,3,4,5,6,7,8,9,0};
// array number 2
int arr2[] = {1,2,3,4,5,6,7,8,9,0,4,3,4,6,4,5,6};
int size_of_A1,size_of_A2,sum;
int loop1=0,loop2=0,loop_main=0;
int *p;
//get number of element in arr1 and arr2 and sum
size_of_A1 = sizeof(arr1)/sizeof(int);
size_of_A2 = sizeof(arr2)/sizeof(int);
sum = size_of_A1 + size_of_A2;
// alocate memory for array size of arr1+arr2
p = (int*)calloc(sum,sizeof(int));
// input elements from string one
while(loop1 != size_of_A1)
{
p[loop_main] = arr1[loop1];
loop1++;
loop_main++;
}
loop_main++; // increment loop main for 1 becose you started from inedex zero
//input elements of arr2 and set it on top arr1 in new arr
while(loop2 != size_of_A2)
{
loop_main[p] = arr2[loop2];
loop2++;
loop_main++;
}
//print elements of new arr and set loop_main to 0
loop_main=0;
while(loop_main != sum)
{
printf("%d,",loop_main[p]);
loop_main++;
}
free(p);
//this is for stoping program at end
getchar();
getchar();
return 0;
}