Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- typedef struct {
- int i;
- char a;
- char b[3];
- float * c;
- char s[100];
- } T;
- #define _sizeof(T) ({ \
- typeof(T *) p = 0; \
- ((size_t) (p + 1)); \
- })
- int main() {
- printf("sizeof int = %zu\n", _sizeof(int)); // 4
- printf("sizeof struct T = %zu\n", _sizeof(T)); // 120
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement