I need to shift array elements to the right a certain number of times?

First: I have no idea what I'm doing or where to begin. I've been told by my professor that this problem is supposed to be "a simple loop inside a loop". Yet I don't understand anything about this problem. I'm supposed to shift all of its elements to the RIGHT by M elements, where M is an integer >= 0. I'm also supposed write a function taking in an integer array (arr[]), its length (N), and the number of elements to right-shift (M). What do I do? How do I even begin? And is there a place that could explain this to me?

Moving right is the "easy part", but what to do with the "edges"?

The first element will shift M positions. What values should be in the M-1 first elements after the shift? The original values have all moved away towards right.

The element M steps left of the last element will move right to the very last position in the array. Are the original last M-1 elements simply overwritten, or what?
Topic archived. No new replies allowed.