I got this from a site which was explaining sorting. But i could not understand *(int*)x. How to read the variable x when used like this in C program? Is it pointer to pointer of x or is it different? Any help is appreciated. Thanks!
I got this from a site which was explaining sorting. But i could not
Share
You can get there if you split it up, first:
This casts
xto anint*, pointer to anint. I assume in this case,xis anint, so the number inxgets interpreted as a pointer.In the next step:
*dereferences a pointer, in this case the just castedint. The result is anint.In short: Interpret an
intas a pointer and get the value it points to.