Hello! i got this code. However i'm really not familiar with memcpy function. Can anybody can show me the other way to write that code without using memory function?
void rightRotate (int k, int n)
{
char temp [2*MAX], *saveptr;
saveptr = num+k; //
cout << "k" << k << "\n";
memcpy (temp , saveptr, n);
memcpy (temp + n , saveptr, n); //
memcpy (saveptr, temp+n - 1, n); //
}
i'm familiar with this code:
void rightRotate(int *y, int n)
{
int temp ;
for (int i = 1; i<= n, i++)
{
temp = y[i];
y[i] = y[n-i+1];
y[n-i+1] = temp;
}
}
is it similar?