Skip to content

Instantly share code, notes, and snippets.

@Heasummn
Created September 11, 2017 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Heasummn/9d316f7ec6b955ae519f5fb0c4e47b82 to your computer and use it in GitHub Desktop.
Save Heasummn/9d316f7ec6b955ae519f5fb0c4e47b82 to your computer and use it in GitHub Desktop.
#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