0% found this document useful (0 votes)
2 views1 page

C Program for Queue Element Addresses

The document contains a C program that implements a simple queue using an array. It prompts the user to enter five elements, stores them in the queue, and then prints each element along with its memory address. The program utilizes pointers to manage the head and tail of the queue.

Uploaded by

Akash Verma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

C Program for Queue Element Addresses

The document contains a C program that implements a simple queue using an array. It prompts the user to enter five elements, stores them in the queue, and then prints each element along with its memory address. The program utilizes pointers to manage the head and tail of the queue.

Uploaded by

Akash Verma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

4 queue

1 #include<stdio.h>
2 #include<conio.h>
3 void main()
4 {
5 int queue[5],i;
6 int *head,*tail;
7 head=queue;
8 tail=queue;
9 clrscr();
10 printf("Enter the elments in the queue:");
11 for(i=0;i<5;i++)
12 {
13 scanf("%d",tail++);
14 }
15
16 printf("The address associated with those elments in the queue
are:-");
17 for ( i = 0; i < 5; i++)
18 {
19
20 printf("\n%d is at %u",*head,head);
21 head++;
22 }
23 getch();
24
25 }

OUTPUT

Enter the elments in the queue: 1 2 3 4 5

The address associated with those elments in the queue are:-

1 is at 6422272

2 is at 6422276

3 is at 6422280

4 is at 6422284

5 is at 6422288

You might also like