void filter(int n, char a[])
{
int j = 0;
while (n > 0)
{
int last_bit = (n & 1);
if (last_bit)
{
cout << a[j];
}
j++;
n = n >> 1;
}
cout << endl;
}
void print_subsets(char a[])
{
int len = strlen(a);
for (int i = 0; i < (1 << len); i++)
{
filter(i, a);
}
}
Can you explain to me why are we writing (1<<len) as the condition in the for loop in print_subsets() function.