res points to a struct addrinfo

This article explains how linked lists work:
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 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.