fix mismatch xstr vs str
This commit is contained in:
24
notes.md
24
notes.md
@@ -341,28 +341,28 @@ int main()
|
||||
|
||||
```
|
||||
#include <stdio.h>
|
||||
#define xstr(s) #s
|
||||
#define str(s) xstr(s)
|
||||
#define str(s) #s
|
||||
#define xstr(s) str(s)
|
||||
#define MAIN(s) \
|
||||
int main() \
|
||||
{ \
|
||||
char *quine = "#include <stdio.h>\n#define xstr(s) #s\n#define str(s) xstr(s)\n#define MAIN(s) " \
|
||||
char *quine = "#include <stdio.h>\n#define str(s) #s\n#define xstr(s) str(s)\n#define MAIN(s) " \
|
||||
s \
|
||||
"\n\nMAIN(str(MAIN(s)))\n"; \
|
||||
"\n\nMAIN(xstr(MAIN(s)))\n"; \
|
||||
printf(quine); \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
MAIN(str(MAIN(s)))
|
||||
MAIN(xstr(MAIN(s)))
|
||||
```
|
||||
|
||||
**expands to :**
|
||||
```
|
||||
int main()
|
||||
{
|
||||
char *quine = "#include <stdio.h>\n#define xstr(s) #s\n#define str(s) xstr(s)\n#define MAIN(s) "
|
||||
"int main() { char *quine = \"#include <stdio.h>\\n#define xstr(s) #s\\n#define str(s) xstr(s)\\n#define MAIN(s) \" s \"\\n\\nMAIN(str(MAIN(s)))\\n\"; printf(quine); return 0; }"
|
||||
"\n\nMAIN(str(MAIN(s)))\n";
|
||||
char *quine = "#include <stdio.h>\n#define str(s) #s\n#define xstr(s) str(s)\n#define MAIN(s) "
|
||||
"int main() { char *quine = \"#include <stdio.h>\\n#define str(s) #s\\n#define xstr(s) str(s)\\n#define MAIN(s) \" s \"\\n\\nMAIN(xstr(MAIN(s)))\\n\"; printf(quine); return 0; }"
|
||||
"\n\nMAIN(xstr(MAIN(s)))\n";
|
||||
printf(quine);
|
||||
return 0;
|
||||
}
|
||||
@@ -371,11 +371,11 @@ int main()
|
||||
**output :**
|
||||
```
|
||||
#include <stdio.h>
|
||||
#define xstr(s) #s
|
||||
#define str(s) xstr(s)
|
||||
#define MAIN(s) int main() { char *quine = "#include <stdio.h>\n#define xstr(s) #s\n#define str(s) xstr(s)\n#define MAIN(s) "s"\n\nMAIN(str(MAIN(s)))\n"; printf(quine); return 0; }
|
||||
#define str(s) #s
|
||||
#define xstr(s) str(s)
|
||||
#define MAIN(s) int main() { char *quine = "#include <stdio.h>\n#define str(s) #s\n#define xstr(s) str(s)\n#define MAIN(s) "s"\n\nMAIN(xstr(MAIN(s)))\n"; printf(quine); return 0; }
|
||||
|
||||
MAIN(str(MAIN(s)))
|
||||
MAIN(xstr(MAIN(s)))
|
||||
```
|
||||
|
||||
**victory ;)**
|
||||
|
||||
Reference in New Issue
Block a user