Question: Hi so I've been working on this program and I need help debugging and fixing it . Its 2 files, one is C and the
Hi so I've been working on this program and I need help debugging and fixing it Its files, one is C and the other is NASM x Assembly.
The C File:
#include
#include
extern int addstrasmint a int b;
extern int ispalindromeasmchar s;
extern int factasmint n;
extern void option;
int addstrchar a char b
int num atoia; Convert strings to integers
int num atoib;
return addstrasmnum num;
int ispalindromechar s
return ispalindromeasms;
int factchar s
int num atois;
return factasmnum;
int ispalindromecchar buf int len
int i j;
for i j len ; i len ; i j
if bufi bufj
return ; Not a palindrome
return ; Palindrome
int main
int choice;
char string;
char string;
do
printf
Menu:
;
printf Add two numbers together.
;
printf Test if a String is a palindrome C ASM
;
printf Print the factorial of a number.
;
printf Test if a string is a palindrome ASM C
;
printf Exit Program.
;
printfEnter a choice: ;
scanfd &choice;
ifchoice choice
printfInvalid selection! Please try again.";
else ifchoice
printfPlease enter a Number: ;
scanfs string;
printfPlease enter another Number: ;
scanfs string;
int result addstrstring string;
printfThe result of adding the two strings is: d
result;
else if choice
printfPlease enter a String: ;
scanfs string; Prevent buffer overflow
Debug: Print the input string
printfDebug: Input string is s
string;
Call the assembly palindrome function
int result ispalindromestring;
if result
printfThe string s is a palindrome.
string;
else if result
printfThe string s is not a palindrome.
string;
else ifchoice
printfPlease enter a Number: ;
scanfs string;
int factresult factstring;
printfThe factorial of s is: d
string factresult;
else ifchoice
option;
whilechoice ;
Unfortunately The assembly code wont fit on here due to the character limit so it will have to be in an image.
exitoption only has ret for a command.
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
