Remix.run Logo
teo_zero 15 hours ago

I'm lost at the first line of code:

  char buffer[64];
And then it's not used anywhere!

I was curious about the "Why not printf" section, but I found code I don't understand there, too. For example this admittedly non-working snippet is cited as idiomatic:

  char str[4] = {0};
  int cursor = 0;
  cursor += snprintf(str, sizeof str, "hello ");
  cursor += snprintf(str, sizeof str, "world!");
Of corse this doesn't work (if the intent was to assemble the "hello world!" string, of which I'm not entirely sure), but not for the reason stated in TFA. You need to actually use cursor, not merely set it! :)