This is my code, its a simple code block for permutation:
void arrange(char c[], int N, int start)
{
if (start == N)
{
print(c, N);
return;
}
for (int i = start; i < N; i++)
{
swap(c[start], c[i]);
arrange(c, N, i + 1);
swap(c[start], c[i]);
}
}
int main(int argc, char const *argv[])
{
char c[] = { 'A','B','C' };
int N = (sizeof(c) / sizeof(char));
arrange(c, N, 0);
return 0;
}
Its not giving the output I expect and I wanted to debug this code. I wanted to observe the character swaps in the input array. But when I debug, the input array cannot be expanded.
If you have an array t that is pointed to by p, like this:
double t[5] = {0,1,2,4.5,2.3};
double *p = t;
You can watch p on the debugger if you recast it.
Just write on the watch window:
(double[5]) *p
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With