An open API service indexing awesome lists of open source software.

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

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