something better then previous
Code:
#include<stdio.h>
#include<stdlib.h>
struct structure_name
{
int i;
char c;
float f;
struct structure_name * n;
};
int main ()
{
struct structure_name * structure_variable = NULL;
structure_variable = malloc (sizeof(structure_variable));
structure_variable->i = 100;
structure_variable->c = 'x';
structure_variable->f = 23.30;
printf("pointer of structure : %p \n", structure_variable);
printf("memory location of first object of structure : %p \n", &(structure_variable->i ));
printf("memory location of second object of structure : %p \n", &(structure_variable->c ));
printf("memory location of third object of structure : %p \n", &(structure_variable->f ));
printf("pointer point to the loaction %p of first object of structure where i is : %d \n", &(structure_variable->i ), (structure_variable->i ));
printf("pointer point to the loaction %p of second object of structure where c is : %c \n", &(structure_variable->c ), (structure_variable->c ));
printf("pointer point to the loaction %p of third object of structure where f is : %f \n", &(structure_variable->f ), (structure_variable->f ));
return 0;
}
pointer of structure : 00B413A8
memory location of first object of structure : 00B413A8
memory location of second object of structure : 00B413AC
memory location of third object of structure : 00B413B0
pointer point to the loaction 00B413A8 of first object of structure where i is : 100
pointer point to the loaction 00B413AC of second object of structure where c is : x
pointer point to the loaction 00B413B0 of third object of structure where f is : 23.299999