-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsll1.c
42 lines (37 loc) · 760 Bytes
/
sll1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdio.h>
#include <malloc.h>
struct node
{
int data;
struct node * next;
}* head;
void create(int n){
head = (struct node *) malloc(sizeof(struct node));
head->data = n;
head->next = NULL;
}
// void insert_last(int n){
// struct node *next = (struct node *) malloc(sizeof(struct node));
// printf("Enter value ");
// scanf("%d",&next->data);
// printf("1");
// last->next = next;
// printf("1");
// last = next;
// printf("1");
// }
void display(){
struct node *temp;
temp = head;
if (temp != NULL){
while(temp != NULL){
printf("data is : %d",temp->data);
temp = temp->next;
}
}
}
int main() {
create(10);
display();
return 0 ;
}