Contact: aviboots(AT)netvision.net.il
39,890 questions
51,817 answers
573 users
#include <stdio.h> struct test { int n; char ch; float f; }; int main(int argc, char **argv) { struct test arr[2]; int size = (char*)&arr[1] - (char*)&arr[0]; printf("%d",size); return(0); } /* run: 12 */
#include <stdio.h> struct test { int n; char ch; float f; }; int main(int argc, char **argv) { struct test t; struct test *p = &t; int size = (char*)(p + 1) - (char*)p; printf("%d",size); return(0); } /* run: 12 */