Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22113

How to specifically use assembly inline in C? [duplicate]

$
0
0

Let's say I have the following function in C:

void sum(){

      float a,b,ans; 
      a = 1.0; b = 2.0; //I do use scanf for a and b for for simplicity i'll just use random numbers
      ans = a+b;      
      printf("Answer is %.2f",ans);
    }

How can I make the exact same behavior (mathematically operate 2 variables and store the result in another variable) using inline assembly in C? Replacing only the ans = a+b line would be ideal, I'm using gcc or MinGW for windows version of Codeblock compilers if it changes anything.


Viewing all articles
Browse latest Browse all 22113

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>