new file structure according to subject

This commit is contained in:
asus
2024-01-26 12:30:38 +01:00
parent 78959d77cd
commit 318cff516b
11 changed files with 13 additions and 9 deletions

8
C/2_Grace/Grace.c Normal file
View File

@@ -0,0 +1,8 @@
#include <stdio.h>
#define xstr(s) #s
#define str(s) xstr(s)
#define MAIN(s) int main() { char *before = "#include <stdio.h>\n#define xstr(s) #s\n#define str(s) xstr(s)\n#define MAIN(s) "; char *quine = s; char *after = "\n/*\n comment\n*/\nMAIN(str(MAIN(s)))\n"; FILE *file = fopen("Grace_kid.c", "w"); fprintf(file, "%s%s%s", before, quine, after); fclose(file); return 0; }
/*
comment
*/
MAIN(str(MAIN(s)))

View File

@@ -0,0 +1,18 @@
#include <stdio.h>
#define xstr(s) #s
#define str(s) xstr(s)
#define MAIN(s) \
int main() \
{ \
char *before = "#include <stdio.h>\n#define xstr(s) #s\n#define str(s) xstr(s)\n#define MAIN(s) "; \
char *quine = s; \
char *after = "\n/*\n comment\n*/\nMAIN(str(MAIN(s)))\n"; \
FILE *file = fopen("Grace_kid.c", "w"); \
fprintf(file, "%s%s%s", before, quine, after); \
fclose(file); \
return 0; \
}
/*
comment
*/
MAIN(str(MAIN(s)))

6
C/2_Grace/Makefile Normal file
View File

@@ -0,0 +1,6 @@
NAME = Grace
SRCS = Grace.c
CLONES = $(NAME)_kid.c
CREATE_CLONE = ./$(NAME)
include ../MakefileCommon