Originally Posted by
samGwilliam
Here's another question along the same lines: Why do some keywords have a normal version and a version with two underscores preceding (asm/__asm, for example)?
in my vc++ _asm is for one liners. __asm{} is for blocks
Code:
#include <stdio.h>
int main()
{
int x = 65;
int *y = &x;
char format[] = "%i";
printf("X equals: ");
_asm mov eax, y; //move the address of x into eax
//could have been placed in next block
//just using it as an example
__asm
{
push format; //push format string onto stack
push eax; //now eax (the address of x)
call printf; //call C's printf
pop eax; //clean up the stack
}
_asm pop eax; //clean up the stack
//also could have been place inside __asm{}
return 0;
}
edit: this is probably not good or safe code. i've only dabbled in the realm of asm w/ c/c++