S
sarathy
Hi,
1. How it that the results for the size of struct1 and struct2 (below)
are 4 and 3
# include <stdio.h>
struct struct1
{
const :16;
volatile :4;
};
struct struct2
{
int :1;
unsigned :1;
const :16;
volatile :4;
};
int main()
{
printf ("Size of struct 1 = %d\n",sizeof(struct struct1)); /*
Prints 4 */
printf ("Size of struct 2 = %d\n",sizeof(struct struct2)); /*
Prints 3 */
}
2. Also what is meant by "incomplete type" in C?
3. What does tag refer to in a struct/union declaration?
Regards,
Sarathy
1. How it that the results for the size of struct1 and struct2 (below)
are 4 and 3
# include <stdio.h>
struct struct1
{
const :16;
volatile :4;
};
struct struct2
{
int :1;
unsigned :1;
const :16;
volatile :4;
};
int main()
{
printf ("Size of struct 1 = %d\n",sizeof(struct struct1)); /*
Prints 4 */
printf ("Size of struct 2 = %d\n",sizeof(struct struct2)); /*
Prints 3 */
}
2. Also what is meant by "incomplete type" in C?
3. What does tag refer to in a struct/union declaration?
Regards,
Sarathy