123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include<stdlib.h>
- #include<stdio.h>
- struct foo
- {
- struct foo* next;
- struct foo* prev;
- int a;
- int b;
- };
- void print_hex(int a, int count)
- {
- if(count <= 0) return;
- print_hex(a >> 4, count - 1);
- putchar((a & 15) + 48);
- }
- int main()
- {
- struct foo* a = malloc(sizeof(struct foo));
- struct foo* b = malloc(sizeof(struct foo));
- a->a = 0x35419896;
- a->b = 0x57891634;
- b->a = 0x13579246;
- b->b = 0x64297531;
- a->next = b;
- a->prev = b;
- b->next = a;
- b->prev = a;
- print_hex(a->next->next->a, 8);
- print_hex(b->prev->prev->b, 8);
- print_hex(b->next->a, 8);
- print_hex(b->prev->b, 8);
- putchar(10);
- return sizeof(struct foo);
- }
|