-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinkedListNode.h
More file actions
64 lines (51 loc) · 1.13 KB
/
linkedListNode.h
File metadata and controls
64 lines (51 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* AUTOR: Luis Eduardo Galindo Amaya FECHA: 26-02-2023
*
* DESCRIPCIÓN:
* En este archivo se encuentrara todos los metodos para crear nodos para
* linkedList.
*/
#ifndef linkedListNode
#define linkedListNode
#define PRIORITY_DATA_TYPE int
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct LinkedListNode
{
/* Propiedades */
PRIORITY_DATA_TYPE priority;
/* Required */
struct LinkedListNode *next;
} LinkedListNode;
/**
* Crear un nodo para la lista
*/
LinkedListNode *linkedListNodeCreate(PRIORITY_DATA_TYPE priority)
{
LinkedListNode *foo = malloc(sizeof(LinkedListNode));
if (foo == NULL)
{
printf("LinkedListNodeCreate: No se pudo reservar memoria!!\n");
exit(EXIT_FAILURE);
}
foo->priority = priority;
return foo;
}
/**
* Imprime el valor en el stdio
*/
void linkedListNodeDisplay(LinkedListNode *node)
{
printf("prioridad: %d\n", node->priority);
}
/**
* Copiar un nodo de la lista
* @param node direccion al nodo
* @return
*/
LinkedListNode *linkedListNodeCopy(LinkedListNode *node)
{
return linkedListNodeCreate(node->priority);
}
#endif