Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tiehuis committed Jul 17, 2017
0 parents commit 572d12a
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
main
build/
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SRCS := compute.c compute_helper.c display.c main.c
OBJS := $(SRCS:%.c=build/%.o)

main: $(OBJS)
gcc -o main $(OBJS)

$(OBJS): build/%.o: %.c | mkdirs
gcc -std=c99 -c $< -o $@

mkdirs:
@mkdir -p build

clean:
rm -rf build main
6 changes: 6 additions & 0 deletions compute.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "compute_helper.h"

char compute(char a)
{
return compute_helper(a) + 5;
}
1 change: 1 addition & 0 deletions compute.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
char compute(char a);
4 changes: 4 additions & 0 deletions compute_helper.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
char compute_helper(char a)
{
return a + 1;
}
1 change: 1 addition & 0 deletions compute_helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
char compute_helper(char a);
6 changes: 6 additions & 0 deletions display.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <stdio.h>

void display_char(char c)
{
printf("%c\n", c);
}
1 change: 1 addition & 0 deletions display.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void display_char(char c);
7 changes: 7 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "display.h"
#include "compute.h"

int main(void)
{
display_char(compute('A'));
}

0 comments on commit 572d12a

Please sign in to comment.