CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 01:13:47 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=681690026319e65f98ef225e3d8acc0b6d8c4efb1687c862a283d81fdd16d150a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22SF6lz0dNv58Mi5f7deqy-Y4HE2sWBWJp%22%3B%7D; HttpOnly; Path=/
cf-ray: 98ca7f3419a7d817-BLR
dfdfd - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- struct node
- {
- int value;
- struct node *next;
- };
- struct node *head = NULL,*tail = NULL;
- void insertlast(int x);
- void print();
- void remove(int x);
- int length();
- int main()
- {
- while(1)
- {
- printf("...MENU...\n");
- printf("(1) Insert Last\n");
- printf("(2) Show All\n");
- printf("(3) Remove\n");
- printf("(4) Exit\n");
- printf("------------\n");
- printf("Enter Your Choice:");
- int choice;
- scanf("%d",&choice);
- int x;
- switch(choice)
- {
- case 1:
- printf("Enter Number: ");
- scanf("%d",&x);
- insertlast(x);
- print();
- break;
- case 2:
- print();
- break;
- case 3:
- printf("Which value you want to remove : ");
- scanf("%d",&x);
- remove(x);
- print();
- break;
- case 4:
- exit(0);
- }
- getchar();
- }
- }
- void print()
- {
- node *currentnode=head;
- printf("\nYour List is: ");
- while(currentnode!=NULL)
- {
- printf("%d ",currentnode->value);
- currentnode= currentnode->next;
- }
- printf("\n\n\n");
- }
- void insertlast(int x)
- {
- node *temp=(node*)malloc(sizeof(node));
- if(head==NULL)
- {
- temp->value=x;
- temp->next=NULL;
- head=temp;
- tail=temp;
- }
- else
- {
- temp->value=x;
- temp->next=NULL;
- tail->next=temp;
- tail=temp;
- }
- }
- int search(int x)
- {
- node *currentnode=head;
- while(currentnode!=NULL)
- {
- if(currentnode->value==x)
- return 1;
- currentnode= currentnode->next;
- }
- return 0;
- }
- int length()
- {
- int l=0;
- node *currentnode=head;
- while(currentnode!=NULL)
- {
- l++;
- currentnode= currentnode->next;
- }
- return l;
- }
- void remove(int x)
- {
- node *temp=NULL,*prev=NULL,*currentnode =head;
- if(search(x))
- {
- if(head->value==x)
- {
- temp=head;
- head=head->next;
- free(temp);
- }
- else
- {
- while(currentnode->next!=NULL)
- {
- if(currentnode->next->value==x)
- {
- prev=currentnode;
- temp=currentnode->next;
- break;
- }
- else
- currentnode=currentnode->next;
- }
- if(temp->next==NULL)
- {
- prev->next=NULL;
- tail=prev;
- free(temp);
- }
- else
- {
- prev->next=temp->next;
- free(temp);
- }
- }
- }
- else
- printf("Not found for remove");
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
✅ Make $2500 in 20 minutes⭐⭐⭐ 4
JavaScript | 8 sec ago | 0.24 KB
-
⭐⭐Exchange Exploit⭐⭐ 2
JavaScript | 19 sec ago | 0.24 KB
-
✅⭐ Make huge profits on trading ⭐⭐ O
JavaScript | 32 sec ago | 0.24 KB
-
⭐✅ MAKE $2500 IN 15 MIN⭐⭐⭐ U
JavaScript | 55 sec ago | 0.24 KB
-
⭐✅ MAKE $2500 IN 15 MIN⭐⭐⭐ A
JavaScript | 58 sec ago | 0.24 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ L
JavaScript | 1 min ago | 0.24 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ Y
JavaScript | 1 min ago | 0.24 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ 8
JavaScript | 1 min ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand