code below gives O/P 4 when sizeof(obj) is computed..how it works..is structure padding different for pointer data types..

#include <stdio.h>
struct x
{
double *a;
};
int main()
{
struct x obj;
printf("%d\n",sizeof(obj));
return 0;
}
  • created

    Aug '11
  • last reply

    Aug '11
  • 1

    reply

  • 274

    views

  • 2

    users

10 days later

I'm not certain what you mean by structure padding. I would expect 4 to be the output.

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 14 6d

Want to read more? Browse other topics in C and C++ or view latest topics.