I have three Pointers:
int *x,*y, *Temp; And then I have done
x = (int *)malloc(sizeof(int)*m); y = (int *)malloc(sizeof(int)*n); Temp = (int *)malloc(sizeof(int)*(m+n)); where m and n are certain values.
Next, I have entered values into Temp.
for(i=0; i < m+n; i++) { scanf("%d", Temp+i); } I want half of Temp in x and the other half in y. How do I do this?
for(i=0; i < m; i++) { x[i] = Temp[i]; } The code above to copy the contents is not working!
Also, how do I print the values?
malloc(or any function returningvoid *).2to the size ofTemp?callocwhich initializes the allocated memory or usememsetto set the memory locations to NULL.