[categories] [index] [all (531)] [latest]
int n = 1;
int isLittleEndian = (*(char *)&n == 1);
// $ gcc -m32 -fasm-blocks asm.c -o asm
#include <stdio.h>
int main (int argc, char *argv[]) {
int espValue;
_asm {
mov [espValue], esp;
}
printf("espValue: %u\n", espValue);
return 0;
}
void x() {
void *returnAddress = __builtin_return_address(0);
printf("%p\n", returnAddress);
}
The level argument is number of frames to scan up the call stack.
int a[3]= { 1, 2, 3 };
int len = sizeof(a)/sizeof(*a);