Skip to content

Commit fcd5141

Browse files
author
robertDurst
committed
Remove direct text to output
1 parent 61497f5 commit fcd5141

File tree

2 files changed

+55
-112
lines changed

2 files changed

+55
-112
lines changed

out.c

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,47 @@
1010
void
1111
print_bool(int i)
1212
{
13-
if (i == 1)
14-
printf("%s", "true");
15-
else
16-
printf("%s", "false")
17-
;
13+
if (i == 1)
14+
printf("%s", "true");
15+
else
16+
printf("%s", "false");
1817
}
1918
void
2019
print_flt(float f)
2120
{
22-
printf("%f", f);
21+
printf("%f", f);
2322
};
2423
void
2524
print_int(int i)
2625
{
27-
printf("%d", i);
26+
printf("%d", i);
2827
};
2928
void
3029
print_str(char* s)
3130
{
32-
printf("%s", s);
31+
printf("%s", s);
3332
};
3433
// -------- STDLIB_END ------- //
3534

36-
typedef struct _Node_ {
35+
typedef struct _Node_
36+
{
3737
struct _Node_* next;
3838
int data;
3939
} Node;
4040

4141
Node*
42-
construct_Node(Node* next,int data)
42+
construct_Node(Node* next, int data)
4343
{
4444
Node* a____struct___generated = (Node*)malloc(sizeof(Node));
45-
a____struct___generated->next = next; a____struct___generated->data = data;
45+
a____struct___generated->next = next;
46+
a____struct___generated->data = data;
4647
return a____struct___generated;
4748
}
4849

4950
int
5051
has_next(Node* own)
5152
{
52-
int ret = (own->next!=NULL);
53+
int ret = (own->next != NULL);
5354
return ret;
5455
}
5556
void
@@ -67,23 +68,25 @@ data(Node* own)
6768
{
6869
return own->data;
6970
}
70-
typedef struct _Stack_ {
71+
typedef struct _Stack_
72+
{
7173
struct _Node_* head;
7274
int size;
7375
} Stack;
7476

7577
Stack*
76-
construct_Stack(Node* head,int size)
78+
construct_Stack(Node* head, int size)
7779
{
7880
Stack* a____struct___generated = (Stack*)malloc(sizeof(Stack));
79-
a____struct___generated->head = head; a____struct___generated->size = size;
81+
a____struct___generated->head = head;
82+
a____struct___generated->size = size;
8083
return a____struct___generated;
8184
}
8285

8386
int
8487
is_empty(Stack* own)
8588
{
86-
return (own->size==0);
89+
return (own->size == 0);
8790
}
8891
int
8992
size(Stack* own)
@@ -94,14 +97,13 @@ int
9497
peek(Stack* own)
9598
{
9699
int i = 0;
97-
if(is_empty(own)==1)
98-
{
99-
100-
}
101-
else
102-
{
103-
i = data(own->head);
104-
}
100+
if (is_empty(own) == 1)
101+
{
102+
}
103+
else
104+
{
105+
i = data(own->head);
106+
}
105107

106108
return i;
107109
}
@@ -110,36 +112,32 @@ push(Stack* own, Node* node)
110112
{
111113
set_next(node, own->head);
112114
own->head = node;
113-
own->size = own->size+1;
115+
own->size = own->size + 1;
114116
}
115117
void
116118
pop(Stack* own)
117119
{
118-
if(is_empty(own)==1)
119-
{
120-
121-
}
122-
else
123-
{
124-
own->head = next(own->head);
125-
own->size = own->size-1;
126-
}
127-
120+
if (is_empty(own) == 1)
121+
{
122+
}
123+
else
124+
{
125+
own->head = next(own->head);
126+
own->size = own->size - 1;
127+
}
128128
}
129129
void
130130
print_(Stack* own, Node* node)
131131
{
132-
if(node!=NULL)
133-
{
134-
print_int(data(node));
135-
print_str(" ");
136-
print_(own, next(node));
137-
}
138-
else
139-
{
140-
141-
}
142-
132+
if (node != NULL)
133+
{
134+
print_int(data(node));
135+
print_str(" ");
136+
print_(own, next(node));
137+
}
138+
else
139+
{
140+
}
143141
}
144142
void
145143
print(Stack* own)
@@ -151,12 +149,12 @@ print(Stack* own)
151149
int
152150
main()
153151
{
154-
Node* a = construct_Node(NULL,10);
155-
Node* b = construct_Node(NULL,20);
156-
Node* c = construct_Node(NULL,30);
157-
Node* d = construct_Node(NULL,40);
158-
Node* e = construct_Node(NULL,50);
159-
Stack* s = construct_Stack(NULL,0);
152+
Node* a = construct_Node(NULL, 10);
153+
Node* b = construct_Node(NULL, 20);
154+
Node* c = construct_Node(NULL, 30);
155+
Node* d = construct_Node(NULL, 40);
156+
Node* e = construct_Node(NULL, 50);
157+
Stack* s = construct_Stack(NULL, 0);
160158
push(s, a);
161159
push(s, b);
162160
push(s, c);

0 commit comments

Comments
 (0)