You will now learn a very useful trick to find out when a variable changes value.
Add a global variable int glob; before any function.
Then add for instance glob += 1 to any function.
Recompile, start gdb and type
Run your program. It should stop when glob is modified.
It is easy to use watch for global variables but to stop when data allocated with malloc or calloc
is modified, you need to know the address of that data.
Put a breakpoint in pivot
Assuming you have a struct s with the array b, type
That should give you the address of element one of the b array.
The address will be a hexadecimal number (base 16). Assume it is 1234567890abc0 and the
type of the element is double.
Continue the program and see what happens.