hello i m given a question in book i m reading that i copy element but using ptr to copy and other choice will be using normal integers to copy
i did normal integer but copy i think i got a problem with it
#include <stdio.h>
int copyarr(const int Mainarr[],int Target[], int * end);
int copyarr(const int Mainarr[],int Target[], int * end)
{
while (Mainarr < end)
*Target=*Mainarr++;
}
int main(void)
{
int const Mainarr[]={1,2,3};
int target[2];
int *end;
end=target+3;
copyarr(Mainarr,target,end);
printf("%d %d %d\n",target[0],target[1],target[2]);//lazy to do a for loop :P
getchar();
return 0;
}