创建队列 c语言
A queue in C is basically a linear data structure
to store and manipulate the data elements. It follows the order of First In First Out (FIFO).
C语言中的队列基本上是用于存储和操作数据元素的linear data structure
。 它遵循先进先出(FIFO)的顺序。
In queues, the first element entered into the array is the first element to be removed from the array.
在队列中,输入到数组中的第一个元素是要从数组中删除的第一个元素。
For example, let’s consider the scenario of a bus-ticket booking stall. Here, the fashion of a C programming queue is followed. The tickets are distributed on the first-come-first-serve basis i.e. the first one to enter is the first one to be served with the tickets.
例如,让我们考虑公交车票预订摊位的情况。 在此,遵循C编程队列的方式。 门票将按照先到先得的原则分配,即,第一个进入的门票将是第一个与门票一起出售的门票。
A queue is open at both ends. One end is provided for the insertion of data and the other end for the deletion of data.
两端都有一个队列 。 提供一端用于插入数据,另一端用于删除数据。
A queue can be implemented with any programming language such as C, Java, Python, etc.
可以使用任何编程语言(例如C,Java,Python等)来实现队列。
与C中的队列相关联的操作 (Operations Associated with a Queue in C )
A queue being an Abstract Data Structure provides the following operations for manipulation on the data elements:
作为抽象数据结构的队列为数据元素提供了以下操作:
isEmpty()
: To check if the queue is emptyisEmpty()
:检查队列是否为空isFull()
: To check whether the queue is full or notisFull()
:检查队列是否已满dequeue()
: Removes the element from the frontal side of the queuedequeue()
:从队列的正面移除元素enqueue()
: It inserts elements to the end of the queueenqueue()
:将元素插入队列的末尾Front
: Pointer element responsible for fetching the first element from the queueFront
:负责从队列中获取第一个元素的指针元素Rear
: Pointer element responsible for fetching the last element from the queueRear
:负责从队列中获取最后一个元素的指针元素