Use assembly code in C

We can also write assembly code in C language. To execute some assembly code inside C language we have to write all the assembly code inside asm{} block. Here we will write a program using assembly code inside the C code.

Here we use TurobC to execute this program. Let’s see the program using assembly code with C programming language.

// Using assembly code with C
void main(){

  int a = 5, b = 10, c;

    mov ax,a
    mov bx,b
    add ax,bx
    mov c,ax

printf("Value of c is = %d", c);

Output of this assembly code program:

Value of c is = 15

Previous pageDecimal to binary by C

Next pageMatrix multiplication by C

More C programming and projects

C learning topics