【发布时间】:2019-08-25 11:25:24
【问题描述】:
我需要将我的 C 代码转换成程序集
这是我需要转换成汇编(.asm)的C代码
int main()
{
//Variables that stores the numbers
int num1, num2, num3;
// Variable that stores the result
int result;
// Asking the user to input the value of num1
printf("Enter the first number:");
scanf("%d",&num1);
// Asking the user to input the value of num2
printf("Enter the second number:");
scanf("%d",&num2);
// Asking the user to input the value of num3
printf("Enter the third number: ");
scanf("%d",&num3);
//Performing the operation
result = num3 - (num1 + num2);
//Printing the result
printf("The value of result is: %d",result);
return 0;
}
【问题讨论】:
-
C 代码由通常称为 C 编译器的程序转换(翻译)为汇编。
-
这取决于一个:你为什么需要这个? b:您希望程序集处于哪种架构中?如果您不熟悉 C 和 ASM - 我建议您先学习这些东西,然后再应对这个复杂的挑战。
-
我将从学习汇编语言开始。此外,一些编译器可以选择在编译时从 C 代码为您生成汇编语言。
-
你还需要用汇编语言写
scanf&printf吗?