fork(1) download
  1. #include <stdio.h>
  2.  
  3. #define STATIC_ASSERT(COND) typedef char static_assertion_##__LINE__[(COND) ? 1 : -1]
  4. #define ENSURE_SIZE(structure, size) STATIC_ASSERT(sizeof(structure) == size)
  5.  
  6. typedef struct
  7. {
  8. unsigned a;
  9. } foo;
  10. ENSURE_SIZE(foo, sizeof(unsigned));
  11.  
  12. int main(void) {
  13. unsigned local_a = 0;
  14. foo *f = (foo *)(&local_a);
  15. printf("address local_a: %X, f->a: %X\n", &local_a, &f->a);
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 2156KB
stdin
Standard input is empty
stdout
address local_a: BF92B2BC, f->a: BF92B2BC