0
void print(int x)
{
    if (x--)
        print(x / 26), putchar((x % 26) + 'A');
}

This is part of a code. I don't understand what the comma after print(x / 26) does. And when x=55 it prints BC.

  • Comma acts as sequence point. First print(x/26) will be called and after returning from that call putchar will be called. In case of x=55, x-- is not zero it first calls print(2). print(2) x-- is not zero it calls print(0) . putchar(1%26+'A') and putchar(54%26+'A') gives BC output. – Venkatesh Nandigama Oct 06 '21 at 16:37
  • 1
    The recursion goes `print(55); print(2); print(0);` – Weather Vane Oct 06 '21 at 16:37
  • It is valid C, but the author should be scrutinised. – Cheatah Oct 06 '21 at 17:42

0 Answers0