Skip to content

Instantly share code, notes, and snippets.

@wat-aro
Created March 11, 2016 06:14
Show Gist options
  • Save wat-aro/75f989e66ebc2021f447 to your computer and use it in GitHub Desktop.
Save wat-aro/75f989e66ebc2021f447 to your computer and use it in GitHub Desktop.
Rakefile
#include<stdio.h>
#include<string.h>
void print_reverse(char *s)
{
size_t len = strlen(s);
char *t = s + len - 1;
while (t >= s){
printf("%c", *t);
t = t - 1;
}
puts("");
}
int main(void)
{
char word[80];
printf("逆順に表示する文字列:");
fgets(word, 80, stdin);
print_reverse(word);
return 0;
}
CC = "gcc"
task :default => "print_reverse"
file "print_reverse" => "print_reverse.o" do
sh "#{ CC } -o print_reverse print_reverse.o"
end
file "print_reverse.o" => "print_reverse.c" do
sh "#{ CC } -c print_reverse.c"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment