Why doesn\'t this code set temp to 1? How do I actually do that?
temp
int temp; __asm__( \".intel_syntax;\" \"mov %0, eax;\" \"mov eax, %
This code does what you are trying to achieve. I hope this helps you:
#include int main(void) { /* Compile with C99 */ int temp=0; asm ( ".intel_syntax;" "mov %0, 1;" ".att_syntax;" : "=r"(temp) : /* no input*/ ); printf("temp=%d\n", temp); }