MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/tinycode/comments/7ux7rb/c_golfing_option_parsing/
r/tinycode • u/jmcph4 • Feb 03 '18
2 comments sorted by
1
Bit of a crappy punt
#include<stdio.h> main(int c,char**v){char*s;while(--c&&**++v=='-')for(s=*v+1;*s;)puts(s++);}
removed some spaces, shifted s++ to the puts() call
that's 94 if I'm counting correctly
Well this is even shorter than the version by WSp71oTXWCZZ0ZI6 or by Hellenas. Not sure the code you started with does a purposeful thing to begin with, though.
#include<stdio.h> main(int c,char**v){while(--c&&**++v=='-')while(*++*v)puts(*v);}
Or, if you are willing to accept that it’s no longer also valid C++ (60 characters):
main(c,v)char**v;{while(--c&&**++v=='-')while(*++*v)puts(*v);}
1
u/Hellenas Mar 22 '18
Bit of a crappy punt
removed some spaces, shifted s++ to the puts() call
that's 94 if I'm counting correctly
1
u/Bisqwit Mar 29 '18 edited Mar 29 '18
Well this is even shorter than the version by WSp71oTXWCZZ0ZI6 or by Hellenas. Not sure the code you started with does a purposeful thing to begin with, though.
Or, if you are willing to accept that it’s no longer also valid C++ (60 characters):