Nt1330 Unit 5 Lab Report

2218 Words9 Pages
13(i) Write a program to create a linear linked list interactively and printout the list and total number of items in the list.PROGRAM#include #include #define NULL 0 struct linked_list { int number; struct linked_list *next; }; typedef struct linked_list node; main () { int n; node *head = NULL; void print(node *p); node *insert_Sort(node *p, int n); printf("Input the list of numbers.\n"); printf("At end, type -999.\n"); scanf("%d",&n); while(n != -999) { if(head…show more content…
PROGRAM #include #include #include #define size 10 #define true…show more content…
[2] To remove an element. [3] To display all the elements. [4] Exit Enter your choice: 1 Element to be inserted: 10 Enter your choice: 1 Element to be inserted: 20 Enter your choice: 1 Element to be inserted: 30 Enter your choice: 3 Element present in the Queue are: 10 20 Enter your choice: 2 10 elements is removed Enter your choice: 3 Element present in the Queue are: 20 30 (ii) Write C programs that implement Queue (its operations) using Pointers. PROGRAM #define true 1 #define false 0 #include #include #include struct q_point { int ele; struct q_point* n; }; struct q_point *f_ptr = NULL; int e_que(void); void add_ele(int); int rem_ele(void); void show_ele(); void main() { int ele,choice,j; while(1) { clrscr(); printf("\n\n****IMPLEMENTATION OF QUEUE USING POINTERS****\n"); printf("= = = = = ="); printf("\n\t\t MENU\n"); printf("= = = = = = "); printf("\n\t[1] To insert an element"); printf("\n\t[2] To remove an

More about Nt1330 Unit 5 Lab Report

Open Document