Last active
August 29, 2015 13:59
-
-
Save aikyo02/10955608 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "util.h" | |
int main(void) { | |
int a = 99; | |
int b = 100; | |
printf("MAX: %d\n", max(a,b)); | |
printf("MIN: %d\n", min(a,b)); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rake/clean' | |
CC = "gcc" | |
SRCS = FileList["**/*.c"] | |
OBJS = SRCS.ext('o') | |
CLEAN.include(OBJS) | |
CLOBBER.include("main") | |
task :default => "main" | |
file "main" => OBJS do |t| | |
sh "#{CC} -o #{t.name} #{t.prerequisites.join(' ')}" | |
end | |
rule '.o' => '.c' do |t| | |
sh "#{CC} -c #{t.source}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "util.h" | |
int max(int a, int b) { | |
if (a >= b) { | |
return a; | |
} | |
return b; | |
} | |
int min(int a, int b) { | |
if (a <= b) { | |
return a; | |
} | |
return b; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int max(int a, int b); | |
int min(int a, int b); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment