belongs to collection: C Programs
We can write assembly program code inside c language program. In such case, all the assembly code must be placed inside asm{} block.
Let's see a simple assembly program code to add two numbers in c program.
#include<stdio.h> void main() { int a = 10, b = 20, c; asm { mov ax,a mov bx,b add ax,bx mov c,ax } printf("c= %d",c); }
Output:
c= 30
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Let's see a simple assembly program code to add two numbers in c program.
Output:
Note: We have executed this program on TurboC.
need an explanation for this answer? contact us directly to get an explanation for this answer