Created
September 11, 2017 23:36
-
-
Save Heasummn/9d316f7ec6b955ae519f5fb0c4e47b82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
struct node | |
{ | |
int data; | |
struct node * next; | |
}; | |
int main() | |
{ | |
struct node head; | |
struct node * headPtr; | |
headPtr = &head; | |
headPtr -> data = 99; | |
struct node node2; | |
struct node * node2Ptr; | |
node2Ptr = &node2; | |
node2Ptr -> data = 88; | |
headPtr -> next = &(node2); | |
struct node node3; | |
struct node *node3Ptr = &node3; | |
node3Ptr -> data = 78; | |
node2Ptr -> next = &(node3); | |
printf("Value of headPtr: %d\n", headPtr->data); | |
printf("Value of head->next: %d\n", headPtr->next->data); | |
printf("Value of node2Ptr-> next: %d\n", node2Ptr->next->data); | |
printf("Value of headPtr's->next->next: %d\n", headPtr->next->next->data); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment