I have to copy one array to another. Both of them are in int* form. I have to copy it till the index reads -1, but it keeps on copying. I tried using the debugger. After reaching -1 it carries on copying data in the rest of the vertices.
void copy(int *a, int *b)
{
int i=0;
while(a[i]!=-1)
{
if(a[i]==-1)
break;
//for( i=0; a[i]!=-1; i++)
a[i]=b[i];
i++;
}
a[i]=b[i];
}
copy(temp->patharray,num);
patharray and num are both int*