Skip to content

Instantly share code, notes, and snippets.

@meetkool
Created February 21, 2026 06:10
Show Gist options
  • Select an option

  • Save meetkool/df896c27f2cc275dad3a8c63456f0e31 to your computer and use it in GitHub Desktop.

Select an option

Save meetkool/df896c27f2cc275dad3a8c63456f0e31 to your computer and use it in GitHub Desktop.
[BLOG] Untitled Post ``` #include <bits/stdc++.h> using namespace std; struct Node { int data; Node* next; N
title date excerpt tags privacy
Untitled Post
2026-02-21
``` #include <bits/stdc++.h> using namespace std; struct Node { int data; Node* next; N
blog
quick-post
public
#include <bits/stdc++.h>
using namespace std;
struct Node
{
    int data;
    Node* next;

    Node(int x){
        data =x;
        next = nullptr; 
    }
};


int main(){
    srand(time(0)); // Seed the random number generator
    Node* head = new Node(10);
    Node* temp = head;
    for(int i=0;i<10;i++){
         temp->next = new Node(rand()%100);
         temp = temp -> next;
    }

    Node* temp2 = head;
    while(temp2 != nullptr){
        cout<<temp2->data<<endl;
        temp2 = temp2 -> next;
    }
    // return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment