-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.c
More file actions
75 lines (65 loc) · 1.04 KB
/
Node.c
File metadata and controls
75 lines (65 loc) · 1.04 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
65
66
67
68
69
70
71
72
73
74
75
/*
CSE 109: Spring 2018
Dylan Spector
drs320
The C file for the NOde obj in a Linked List.
Program #3
*/
#include"Node.h"
#include<stdio.h>
#include<stdlib.h>
struct Node_t* makeNode1(struct Node_t* it)
{
it->value = 0;
it->next = NULL;
return it;
}
struct Node_t* makeNode2(struct Node_t* it, int value)
{
it->value = value;
it->next = NULL;
return it;
}
struct Node_t* makeNode4(struct Node_t* it, int value, struct Node_t* next)
{
it->value = value;
it->next = next;
return it;
}
struct Node_t* freeNode(struct Node_t* it)
{
free(it);
return NULL;
}
int setData(struct Node_t* it, int value)
{
if(it == NULL)
{
return -1;
}
return it->value = value;
}
struct Node_t* setNext(struct Node_t* it, struct Node_t* next)
{
if(it == NULL)
{
return NULL;
}
return it->next = next;
}
int getData(struct Node_t* it)
{
if(it == NULL)
{
return -1;
}
return it->value;
}
struct Node_t* getNext(struct Node_t* it)
{
if(it == NULL)
{
return NULL;
}
return it->next;
}