You should really state what language you are using. I have produced your method in C#, and should be easily translatable in to any other language.
static void RotateRight<T>(T[] arr)
{
T temp = arr[arr.Length - 1];
for (int i = arr.Length - 1; i >= 0; i--)
{
if (i == 0)
arr[i] = temp;
else
arr[i] = arr[i - 1];
}
}
An array is an indexed collection of data elements. First you must declare an array, give its name and data. <span>Once your arrays are declared, you access the elements in an array with the array name, and the index number inside brackets [ ].
So, in every </span><span>programming language, when you access data stored in an array, you must use a command [] (brackets) containing a value that accesses memory occupied by the array.</span>
The OS shell allows access to the operating system services
Constant will be the answer