Hi,
I have created list that only add two numbers
I want to print address of followingsCode:#include<stdio.h> #include<stdlib.h> struct Node { int X; // Structure Member struct Node *Next; // Structure Member }; int main() { struct Node* Head = NULL; // Declear pointer to structure struct Node* Tail = NULL; // Declear pointer to structure Head = malloc(sizeof(struct Node)); // Allocate memory for Head Tail = malloc(sizeof(struct Node)); // Allocate memory for Tail Head -> X = 1; //assign value in first node Head -> Next = Tail; // assign address of next Node Tail -> X = 2; //assign data to second node Tail -> Next = NULL; printf(" %d \n", Head -> X); // Print value of First Node printf(" %d \n", Tail -> X); //// Print value of Second Node return 0; }
Head
Tail
Head -> X
TAIL -> X
Head -> Next
Tail -> Next
I don't have any idea how to do it.
Thank you
Rahul