ip=ntohl(*(uint32_t*)PQgetvalue(result, i, 0));
What is the meaning of this code segment?
My guess is that this code takes an input from Postgr
ntohl means "network to host long." It (presumably) converts an integer type from network (big-endian) to host byte ordering. Be careful when using this method, however, if you are unfamiliar with the endianess of your machine. If you have a little-endian machine and use ntohl on data which is already in little-endian format (i.e. wasn't sent in big-endian or otherwise) you may have problems.
*(unit32_t*) is a casting to a 32-bit unsigned integer pointer (the (unit32_t*) part) and then the preceeding * is the dereference operator on that pointer.
EDIT
Here is a good reference for endianess as pointed out in the comments below by njr: http://en.wikipedia.org/wiki/Endianness