-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathappend.c
81 lines (79 loc) · 1.93 KB
/
append.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// wrong program
// #include<stdio.h>
// #include<stdlib.h>
// struct node
// {
// int data;
// struct node *next;
// }*start,*cn,*last,*head;
// void createNode()
// {
// struct node *newNode;
// newNode=(struct node*)malloc(sizeof(struct node));
// if (newNode==NULL)
// {
// printf("unable to allocate the memory to newNode!");
// exit(1);
// }
// printf("enter the data : ");
// scanf("%d",&newNode->data);
// fflush(stdin);
// newNode->next=NULL;
// start=newNode;
// head=newNode;
// }
// void appendNode()
// {
// struct node *append;
// append=(struct node*)malloc(sizeof(struct node));
// if (append==NULL)
// {
// printf("unable to allocate the memory to newNode!");
// exit(1);
// }
// printf("enter the value : ");
// scanf("%d",&append->data);
// fflush(stdin);
// append->next=NULL;
// last=append;
// last->next=append;
// }
// void printList()
// {
// cn=start;
// int count=0;
// while (cn != NULL)
// {
// printf("the data in node %d is %d \n",++count,cn->data);
// cn=cn->next;
// }
// }
// int main()
// {
// char ch;
// int choice;
// do
// {
// printf("1. create first node.\n");
// printf("2. print list.\n");
// printf("3. append node \n");
// printf("enter ur choice :");
// scanf("%d",&choice);
// fflush(stdin);
// switch (choice)
// {
// case 1:createNode();
// break;
// case 2: printList();
// break;
// case 3: appendNode();
// break;
// default:printf("there is no choice like this !");
// break;
// }
// printf("do u want to continue[y/Y] ? : ");
// scanf("%c",&ch);
// fflush(stdin);
// } while (ch=='y' || ch=='Y');
// return 0;
// }