Question: Convert both to riscv assembly that doesnt segmentation fault please #include struct node _ st { int value; struct node _ st * next _

Convert both to riscv assembly that doesnt segmentation fault please
#include
struct node_st {
int value;
struct node_st *next_p;
};
int findmaxll_c(struct node_st *np){
int v;
int max;
max = np->value;
np = np->next_p;
while (np != NULL){
v = np->value;
if (v > max){
max = v;
}
np = np->next_p;
}
return max;
}
findmaxll Find the maximum value in a linked list.
$ ./findmaxll 12349956789
C: 99
Asm: 99
#include
#include
struct node_st {
int value;
struct node_st *next_p;
};
int findmaxllp_c(struct node_st *np){
int v;
int max;
max = np->value;
printf("v =%d
", max);
np = np->next_p;
while (np != NULL){
v = np->value;
printf("v =%d
", v);
if (v > max){
max = v;
}
np = np->next_p;
}
return max;
}
Find the maximum value in a linked list and print the list elements using printf while traversing the list.
$ ./findmaxllp 12349956789
v =1
v =2
v =3
v =4
v =99
v =5
v =6
v =7
v =8
v =9
C: 99
v =1
v =2
v =3
v =4
v =99
v =5
v =6
v =7
v =8
v =9
Asm: 99

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!