#include <iostream> using namespace std; struct node{ int data; struct node* next; }; int main() { node* head = new node; head-> data = 10; head-> next = NULL; cout << "1st node is "<< head-> data << endl; node* current = new node; current-> data = 20; current-> next = NULL; head-> next = current; cout << "1st node is "<< current-> data << endl; current-> data = 30; current-> next = NULL; head-> next ->next = current; cout << "3rd node is "<< current-> data << endl; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter