Q:

Assembly program in C

0

We can write assembly program code inside c language program. In such case, all the assembly code must be placed inside asm{} block.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

Note: We have executed this program on TurboC.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now