Nios/swap

From ASMBits

nios/load2Previous

Write a function that will swap two array elements. Your function will be passed three parameters: The first is a pointer to the beginning of the array. The second and third parameters are indexes to specify which pair of elements of the array should be swapped.

int swap (int *pointer, int index1, int index2);

Expected solution length: Around 10 lines.

Sample Input

r4=Data, r5=0, r6=2

Sample Output

[Two array elements swapped]

Write your solution here

Upload a source file...