res points to a struct addrinfo

This article explains how linked lists work: http://en.wikipedia.org/wiki/Linked_list
The X box at the right of the topmost illustration would typically be NULL.

> i have a problem in understanding this function inet_ntop

Well, did you try Googling it? No, methinks, because the top hit at http://lmgtfy.com/?q=inet_ntop is an OpenGroup documentation link. Did you try reading the comment just before it ("// convert the IP to a string and print it:")? I guess not otherwise you wouldn't have asked.