News for hackers. Stuff that matters.
Re:Xmas.c, winner of the 1988 International Obfuscated C Cod... by kolleykibber on Saturday December 23, 2023 @10:03PM (#38750708)
Well that post just cost me a couple of hours.

And still 136 bytes off 431:

  #define p printf 
  int main(){const char *g[]={"A Partridge in a Pear 
  Tree.\n","Two Turtle Doves, and","Three French Hens,","Four 
  Calling Birds,","Five Gold Rings,"," Geese-a-Lay"," Swans- 
  a-Swimm","t Maids-a-Milk","e Ladies Danc"," Lords-a-Leap"," 
  Pipers Pip","Twelve Drummers Drumm"};
  const char *d[{"First","Second","Third","Four","Fif","Six","Seven","Eigh","Nin","Ten","Eleven","Twelf"};for(int i=0,j;i<12;i++){p("On 
  the %s%s day of Christmas\nMy true love sent to 
  me\n",d[i],i>2?("th"):"");
  for(j=i;j>=0;j--){p("%s%s%s\n",j>4&&j<11? 
  d[j]:"",g[j],j>4?"ing,":"");}}}
Re:Xmas.c, winner of the 1988 International Obfuscated C Cod... by tgv on Sunday December 24, 2023 @09:12AM (#38753566)
Are those consts really necessary? There are also a few character missing after char *d.
Re:Xmas.c, winner of the 1988 International Obfuscated C Cod... by junon on Sunday December 24, 2023 @09:24AM (#38753645)
which characters are missing?
Re:Xmas.c, winner of the 1988 International Obfuscated C Cod... by huhtenberg on Sunday December 24, 2023 @10:03AM (#38753882)
"]=" after "*d["
Re:Xmas.c, winner of the 1988 International Obfuscated C Cod... by junon on Sunday December 24, 2023 @10:18AM (#38753992)
It's not necessary in C.
Re:Xmas.c, winner of the 1988 International Obfuscated C Cod... by tgv on Sunday December 24, 2023 @12:30PM (#38754998)
You should tell my compiler.
Re:Xmas.c, winner of the 1988 International Obfuscated C Cod... by huhtenberg on Sunday December 24, 2023 @04:18PM (#38756941)

   const char *d[{"First","Second",...,"Twelf"};
is not a valid C unconditionally.
Re:Xmas.c, winner of the 1988 International Obfuscated C Cod... by mananaysiempre on Monday December 25, 2023 @02:24AM (#38760556)
> Are those consts really necessary?

Technically yes, initializing a plain char * from a const char * (from array decay) is a constraint violation (an error the standard requires the compiler to detect and complain about) even in C89. Many compilers will let you off with a warning though.

Re:Xmas.c, winner of the 1988 International Obfuscated C Cod... by huhtenberg on Sunday December 24, 2023 @10:09AM (#38753920)
You can shave 25 more by using printf as is, removing "const", removing spaces between char and *, and removing parenthesis around "th".