Post History
C (gcc), 62 bytes main(){char b[99],*p=strchr(gets(b),0);for(;p-->b;)putch(*p);} This relies on the usual gcc extension abuse. It assumes that max user input is 98 characters + null term, si...
Answer
#4: Post edited
- # C (gcc), 62 bytes
- main(){char b[99],*p=strchr(gets(b),0);for(;p-->b;)putch(*p);}
- This relies on the usual gcc extension abuse. It assumes that max user input is 98 characters + null term, since this wasn't specified.
- ---
Revisited, function-based equivalent of the above (plus I have no idea what compiler I used to get putch working, not gcc/Linux at least):- # [C (gcc)], 53 bytes
- <!-- language-all: lang-c -->
- *o;f(char*s){for(s=strchr(o=s,0);s-->o;)putchar(*s);}
- [Try it online!][TIO-ktcryfme]
- [C (gcc)]: https://gcc.gnu.org/
- [TIO-ktcryfme]: https://tio.run/##FcoxDoMwDADAPa@ImGxEpO4R/UtkCImU4spOy4D4et325qOwEZmNHDNQSTIqnpkFdNYuVAR41umGUUO4c8Tnq/8X/Fq8rO7dP1Ld4c11QXc67zMMZW2NJ3@wtGXA6C77UG5pUwvHFw "C (gcc) – Try It Online"
- # C (gcc), 62 bytes
- main(){char b[99],*p=strchr(gets(b),0);for(;p-->b;)putch(*p);}
- This relies on the usual gcc extension abuse. It assumes that max user input is 98 characters + null term, since this wasn't specified.
- ---
- EDIT: Revisited, function-based equivalent of the above (plus I have no idea what compiler I used to get putch working, not gcc/Linux at least):
- # [C (gcc)], 53 bytes
- <!-- language-all: lang-c -->
- *o;f(char*s){for(s=strchr(o=s,0);s-->o;)putchar(*s);}
- [Try it online!][TIO-ktcryfme]
- [C (gcc)]: https://gcc.gnu.org/
- [TIO-ktcryfme]: https://tio.run/##FcoxDoMwDADAPa@ImGxEpO4R/UtkCImU4spOy4D4et325qOwEZmNHDNQSTIqnpkFdNYuVAR41umGUUO4c8Tnq/8X/Fq8rO7dP1Ld4c11QXc67zMMZW2NJ3@wtGXA6C77UG5pUwvHFw "C (gcc) – Try It Online"
#3: Post edited
- # C (gcc), 62 bytes
- main(){char b[99],*p=strchr(gets(b),0);for(;p-->b;)putch(*p);}
This relies on the usual gcc extension abuse. It assumes that max user input is 98 characters + null term, since this wasn't specified.
- # C (gcc), 62 bytes
- main(){char b[99],*p=strchr(gets(b),0);for(;p-->b;)putch(*p);}
- This relies on the usual gcc extension abuse. It assumes that max user input is 98 characters + null term, since this wasn't specified.
- ---
- Revisited, function-based equivalent of the above (plus I have no idea what compiler I used to get putch working, not gcc/Linux at least):
- # [C (gcc)], 53 bytes
- <!-- language-all: lang-c -->
- *o;f(char*s){for(s=strchr(o=s,0);s-->o;)putchar(*s);}
- [Try it online!][TIO-ktcryfme]
- [C (gcc)]: https://gcc.gnu.org/
- [TIO-ktcryfme]: https://tio.run/##FcoxDoMwDADAPa@ImGxEpO4R/UtkCImU4spOy4D4et325qOwEZmNHDNQSTIqnpkFdNYuVAR41umGUUO4c8Tnq/8X/Fq8rO7dP1Ld4c11QXc67zMMZW2NJ3@wtGXA6C77UG5pUwvHFw "C (gcc) – Try It Online"
#2: Post edited
# C (gcc) 62 bytes- main(){char b[99],*p=strchr(gets(b),0);for(;p-->b;)putch(*p);}
- This relies on the usual gcc extension abuse. It assumes that max user input is 98 characters + null term, since this wasn't specified.
- # C (gcc), 62 bytes
- main(){char b[99],*p=strchr(gets(b),0);for(;p-->b;)putch(*p);}
- This relies on the usual gcc extension abuse. It assumes that max user input is 98 characters + null term, since this wasn't specified.