Hi everybody, thanks for your support for solving my previous problems. Now I'm studying self referential structures. I have written the following code:
#include <stdio.h>
int main()
{
system("clear");
struct node
{
int x;
struct node *next;
} p1;
printf(" \nthe address of node1 = %u",& p1);
printf(" \n\nthe size of node 1 = %d",sizeof( p1));
printf("\n\n the size of info part = %d",sizeof(p1.x));
printf("\n\n the size of pointer part = %ld",sizeof(p1.next));
printf("\nthe size of node is = %d\n",sizeof(struct node));
return;
}
The program compiled with few warning like:
warning: format ‘%u’ expects type ‘unsigned int’, but argument 2 has type ‘struct node *’
Every time I do something with pointer such warning is generated. What is the problem? I don't know that. Can anybody explain why it happen on Linux (specially)?
My second question is as I run the program it shows the size of structure 16 while int take 4 byte (Ubuntu 10) & pointer is of 8 byte. Then why it shows size of structure 16 byte?