In program I am expecting address of 'new' and address of first member sould be same
Code:
#include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
};
struct node *Add( struct node * Head, int value)
{
struct node * new = malloc(sizeof(*new));
printf("addresses of a new : %p \n", (void*)&new);
if( new != NULL )
{
new -> data = value;
printf("addresses of first member : %p \n", (void*)&new->data);
new -> next = NULL;
}
return new;
}
int main ()
{
struct node * head = NULL ;
head = Add( head, 1);
return 0;
}
When I run code I don't understand why I get difffferent value
addresses of a new : 0061FEEC
addresses of first member : 00C10D18