Question: Write an assembly program to find the largest element by searching an array. Use cmp instruction and the appropriate jump instruction (signed or unsigned) to
Write an assembly program to find the largest element by searching an array. Use cmp instruction and the appropriate jump instruction (signed or unsigned) to translate the if and while statements. Use $ operator to calculate the size of the array, and inc instruction to incremenet the index of the array.
int ary[] = {1,5,-3,-4,0,6,11,-9,18} int index = 0; int max = ary[0]; int arraySize = sizeof array / sizeof max while (index < arraySize) { if (ary[index < arraySize) max = ary[index]; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
