Skip to content

Instantly share code, notes, and snippets.

@aikyo02
Last active August 29, 2015 13:59
Show Gist options
  • Save aikyo02/10955608 to your computer and use it in GitHub Desktop.
Save aikyo02/10955608 to your computer and use it in GitHub Desktop.
#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;
}
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
#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;
}
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