https://github.com/mrnazu/monty
C, Stacks, Queues - LIFO, FIFO
https://github.com/mrnazu/monty
c c-programming dsa-algorithm fifo lifo queues stacks
Last synced: 3 months ago
JSON representation
C, Stacks, Queues - LIFO, FIFO
- Host: GitHub
- URL: https://github.com/mrnazu/monty
- Owner: mrnazu
- Created: 2023-03-24T11:22:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-09T14:55:21.000Z (7 months ago)
- Last Synced: 2025-02-07T08:33:21.097Z (5 months ago)
- Topics: c, c-programming, dsa-algorithm, fifo, lifo, queues, stacks
- Language: C
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 0x19. C - Stacks, Queues - LIFO, FIFO
Don’t forget to include them in your header file.
```c
/**
* struct stack_s - doubly linked list representation of a stack (or queue)
* @n: integer
* @prev: points to the previous element of the stack (or queue)
* @next: points to the next element of the stack (or queue)
*
* Description: doubly linked list node structure
* for stack, queues, LIFO, FIFO
*/
typedef struct stack_s
{
int n;
struct stack_s *prev;
struct stack_s *next;
} stack_t;/**
* struct instruction_s - opcode and its function
* @opcode: the opcode
* @f: function to handle the opcode
*
* Description: opcode and its function
* for stack, queues, LIFO, FIFO
*/
typedef struct instruction_s
{
char *opcode;
void (*f)(stack_t **stack, unsigned int line_number);
} instruction_t;
```
## Compilation & Output
Your code will be compiled this way:
```shell
$ gcc -Wall -Werror -Wextra -pedantic -std=c89 *.c -o monty
```
- Any output must be printed on stdout
- Any error message must be printed on stderr