C & C++ Programming
Write a c++ program to get the sizeof an object
#include
#define SIZEOF(X) \
({ \
__typeof__(X) x; \
((char *)(&x + 1) - (char *)&x); \
})
int main(void)
{
struct s {
int x;
float p;
int y;
};
printf("%d\n", SIZEOF(struct s));
return 0;
}