Skip to content

Instantly share code, notes, and snippets.

@aragaer
Created December 11, 2013 09:41
Show Gist options
  • Select an option

  • Save aragaer/7907632 to your computer and use it in GitHub Desktop.

Select an option

Save aragaer/7907632 to your computer and use it in GitHub Desktop.
#if 0
/* o_tannenbaum takes a single integer as its argument */
main(int l,char **O){int(*l0)()=main;l<-1?putchar(
l==- 10?(10<<1)+1<<1:l==- 11?0x10<<1:10):l==- 1
?l=(**++O- ((10<<1<<1)+010))* (* (* O+1)==0?1:10)
+(* (* O+1)==0?0:* (* O+1)- ((10<<1<<1)+010)):
**++O>=(10<<1<<1)+010?**O=l0(- 1,O- 1)+1>>1,
**-- O=**(O+1)- 1,l0(0,O):** --O<0?l==0?**++O
>>=1,l0(++l,-- O):l>**++O?l0(- 10,0),l0(- 010,0):
(l0(- 11,0),l0(++l,-- O)):(l>** O?l>**++O?l0(- 010,0),
++**O,--**-- O,l0(0,O): (l0(- 10,0), l0(++l,--O)):
(l0(- 11,0), l0(++l,O)));}
#endif
int main(int argc, char **argv) {
char width, left, right;
int l;
// the following code parses the argument
width = argv[1][0] - '0';
if (argv[1][1]) // two-digit argument
width = width * 10 + argv[1][1]-'0';
right = (width - 1) / 2;
for (left = right - 1; left >= 0; left--) {
for (l = 0; l <= right; l++)
putchar(l > left ? '*' : ' ');
putchar('\n');
right++;
}
right /= 2;
for (l = 0; l <= right; l++)
putchar(' ');
// we're done, draw the last star and return
putchar('*');
putchar('\n');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment