Some things a client must do and how to do them with C-client:

Connect to a server
Handled by mail_open. See Mailbox Access Functions for a description of the function. To specify the server you want to connect to, you put in in the mailbox name as shown in Mailbox Name Conventions. C-client supports many protocols, but defaults to IMAP if you specify a server hostname. If you're not sure what folder to open (i.e., you're connecting to the server to get an initial list of folders) use INBOX -- I think that's always there.
Log in / Authenticate
Automatically handled by c-client. It will use a callback to let the program know when it needs a username and password

Some links on IMAP client stuff.

The sections most relevant to a beginner client writer are Mailbox Access Functions and Main Program Callbacks (note: these are from the possibly-out-of-date page mentioned above)

IMAP protocol specifications

Information on the latest updates of the IMAP standard

Informational RFCs about IMAP

libEtPan a new C IMAP library, it aims to be easier to use than C-client.

Relevant books