Can we write assembly code in middle of c++ program?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Can we write assembly code in middle of c++ program??

7th Jul 2018, 7:18 AM
Omkar Dedge
Omkar Dedge - avatar
6 Answers
+ 7
Of course you can use inline asm in c / c++. Syntax: __asm{ //instructions } or asm{ //instructions } or __asm__{ } Note: __asm / asm/__asm__ depends on your compiler..
8th Jul 2018, 6:30 AM
Phäñtøm Phôëñïx
Phäñtøm Phôëñïx - avatar
7th Jul 2018, 1:32 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 8
Assembly code and C++ can actually be a powerful combo in certain situations. For instance, if you want to create an operating system, assembly is basically a necessity. C++ has a lot of flexibility. In fact, C++ was used in the process of creating Windows.
7th Jul 2018, 10:27 PM
Dinorami
Dinorami - avatar
+ 5
Yes we can. You have to write: asm{ // Here goes assembly }
7th Jul 2018, 11:13 AM
Jakub Stasiak
Jakub Stasiak - avatar
+ 5
does onyone actually use Assembly code ?
7th Jul 2018, 4:25 PM
Heribert
Heribert  - avatar
+ 4
no doubt of power of assembly, but so hard to write. i think only few people use it, mostly hardware enginiers.
8th Jul 2018, 2:11 AM
Heribert
Heribert  - avatar