#Include Stdio.h
#Include Stdio.h
#include <stdio.h>
#include <stdlib.h>
int data;
} NODE;
void create() {
int data = 1;
scanf("%d", &data);
while (data != 0) {
newnode->data = data;
newnode->next = NULL;
if (head == NULL) {
head = newnode;
} else {
ptr = head;
ptr = ptr->next;
ptr->next = newnode;
scanf("%d", &data);
}
void bubble_sort() {
int temp;
temp = i->data;
i->data = j->data;
j->data = temp;
void display() {
temp = temp->next;
printf("\n");
void bubblesortarray() {
int a[20], n, i, j;
scanf("%d", &n);
scanf("%d", &a[i]);
a[j + 1] = temp;
printf("Sorted array:\n");
printf("\n");
int main() {
int ch;
do {
scanf("%d", &ch);
switch (ch) {
case 1:
bubblesortarray();
break;
case 2:
create();
display();
bubble_sort();
display();
break;
default:
return 0;
MENU
1. Sorting by Array
Sorted array:
1 2 3 4 5
MENU
1. Sorting by Array
3 1 4 5 2
1 2 3 4 5