What is r() and double percent %% in GCC inline assembly language?
Example: int main(void) { int x = 10, y; asm ("movl %1, %%eax;" "movl %%eax, %0;" :"=r"(y) /* y is output operand */ :"r"(x) /* x is input operand */ :"%eax"); /* %eax is clobbered register */ } what is r(y) ? also why %% is used before eax ? Generally single % is used right? Okay, this is gcc inline assembler which very powerful but difficult to understand. First off, the % char is a special char. It lets you define register and number placeholders (mor on this later). Unfortunately the % is also used to as part of a register name (such as %EAX) so in gcc inline assembler you have to use two