Created
March 11, 2016 06:14
-
-
Save wat-aro/75f989e66ebc2021f447 to your computer and use it in GitHub Desktop.
Rakefile
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<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; | |
} |
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
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