I need to create an assembly function that adds two positive numbers together, called by a C program.
The C program would look like this:
#include <stdio.h>
int main(void){
int a = 0;
int b = 0;
int c = 0;
printf( "Enter first number: " );
scanf( "%d", &a );
printf( "Enter second number: " );
scanf( "%d", &b );
sum();
printf( "Answer is %d\n", sum );
}
A requirement is that the assembly function (sum()
) should not have any parameter passing nor return any value. Also, the assembly function is located in a separate file, sum.s, if that matters.
I tried a lot, and read a lot. Still, I can't access the variables inside main()
. Thank you for your help. :)