I have the following code:
#include<stdio.h>
typedef struct _node_1
{
int number;
int scores;
int xyz;
double p;
} Node_1;
typedef struct _node_2
{
int number;
int scores;
int xyz;
struct _node_2 *p;
} Node_2;
typedef struct _node_3
{
int number;
int scores;
int xyz;
struct _node_2 p;
} Node_3;
int main()
{
printf("%d\n",sizeof(Node_1));
printf("%d\n",sizeof(Node_2));
printf("%d",sizeof(Node_3));
return 0;
}
and the output is:
24
24
40
My question is why the result of these 3 examples's outputs are like this and how do we exactly determine the size of a structure? BTW, my operating system is 64-bit. Thank you!