need help shifting arrays!

I am supposed to shift the items in the array one place to the left. I also need to throw out the first element in the array and set the last element in the array to zero. What am I doing wrong or how can improve this?

void shift(int arr[], int size)
{
int i; // A counter


// shift the array
for(i = 1; i <= size-1 ; i++)
{
arr[i - 1] = arr[i];
}


arr[size-1] = 0;// Set the last element in the array to zero


}
Registered users can post here. Sign in or register to post.