Skip to content

Commit 572d12a

Browse files
committed
Initial commit
0 parents  commit 572d12a

File tree

9 files changed

+42
-0
lines changed

9 files changed

+42
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
main
2+
build/

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
SRCS := compute.c compute_helper.c display.c main.c
2+
OBJS := $(SRCS:%.c=build/%.o)
3+
4+
main: $(OBJS)
5+
gcc -o main $(OBJS)
6+
7+
$(OBJS): build/%.o: %.c | mkdirs
8+
gcc -std=c99 -c $< -o $@
9+
10+
mkdirs:
11+
@mkdir -p build
12+
13+
clean:
14+
rm -rf build main

compute.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "compute_helper.h"
2+
3+
char compute(char a)
4+
{
5+
return compute_helper(a) + 5;
6+
}

compute.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
char compute(char a);

compute_helper.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
char compute_helper(char a)
2+
{
3+
return a + 1;
4+
}

compute_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
char compute_helper(char a);

display.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <stdio.h>
2+
3+
void display_char(char c)
4+
{
5+
printf("%c\n", c);
6+
}

display.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
void display_char(char c);

main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "display.h"
2+
#include "compute.h"
3+
4+
int main(void)
5+
{
6+
display_char(compute('A'));
7+
}

0 commit comments

Comments
 (0)