Question: Reverse The Values In The Array The test function accepts two arguments, arr, the start address of an array, and n the size of the
Reverse The Values In The Array
The test function accepts two arguments, arr, the start address of an array, and n the size of the array. Reverse all the elements in the array. Thus, if the array contained:
the reversed array would contain:
Register, r can also be used as temporary variable. r contains the start of arr, r contains n No value is returned.
arch armv
syntax unified
arm
text
align
type test, function
global test
test:
mov r r
sub rr#
top:
cmp r r
bge done
ldr rr r lsl #
ldr rr r lsl #
str rr r lsl #
str rr r lsl #
add r r #
sub rr #
b top
done:
mov pc lr
correct this code of mine not working
test bench:
#include
#include
static void mytestint arr int n
int i ;
n n ;
int t t;
while i n
t arri;
t arrn;
arri t;
arrn t;
i;
n;
extern void testint arr int n;
int testharness void
int arr arr;
int res, expected;
for int i ; i ; i
arri arri rand;
testarr;
mytestarr;
for int i ; i ; i
res arri;
expected arri;
if res expected
printfat id expected d got d
i expected, res ;
return ;
printfpassed test
;
for int i ; i ; i
arri arri rand;
testarr;
mytestarr;
for int i ; i ; i
res arri;
expected arri;
if res expected
printfat id expected d got d
i expected, res ;
return ;
printfpassed test
;
return ;
Recursive Maximum
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
