char symbols[16] = "";
int index = 0;
while (1)
{
if (index % 2)
snprintf(symbols, sizeof symbols, "a%s", symbols);
else
snprintf(symbols, sizeof symbols, "b%s", symbols);
index++;
printf("%s\n", symbols);
}
How output looks: a => bb => aaa => bbbb
I want the output looks: a => ba => aba => baba