//CREATİON OF LİNKLİST
#include <stdio.h>
#include <stdlib.h>
typedef struct
{
int data;
struct Node*next;
} Node;
int main() {
Node* n1;
Node* n2;
Node* n3;
n1 = (Node*)(malloc(sizeof(Node)));
n2 = (Node*)(malloc(sizeof(Node)));
n3 = (Node*)(malloc(sizeof(Node)));
n1 -> data = 10;
n2 -> data = 20;
n3 -> data = 30;
n1 -> next = n2;
n2 -> next = n3;
n3 -> next = NULL;
Node* temp = n1;
while(temp != NULL)
{
printf("\nData: %d , next Adress: %d", temp -> data, temp -> next);
temp = temp -> next;
}
return 0;
}
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