请教一下如何链接成一个链表
typedef struct mailNode MailNode;struct mailNode {
int msgNum;
char *from;
char *to;
char *subject;
char *date;
char *messageId;
char *inReplyTo;
enum statusCode status;
enum priorityCode priority;
char *content;
int year, month, day;
int hour, minute, second;
MailNode *next;
MailNode *revNext;
};
int main(int argc, char* argv[])
{
MailNode *messageList = NULL; // list of messages
FILE *fp = NULL;
int i=0;
char c;
char command[MAXLLENGTH]; // mail client command
if (argc != 2) { // Check for correct usage
fprintf(stderr, "Usage: %s file\n", argv[0]);
exit(1);
}
fp = openMailbox(argv[1]); // open mailbox file
while (i<7){
messageList = getNextMessage(fp);
messageList= messageList->next; //因为不知道怎么把messList串起来,所以这边做不出来。找了半天找到了很多创建节点的例子,但是找不到怎么把它们串起来的例子,谁能给个例子,谢谢
i++;
}
fclose(fp); // We're done with the mailbox file
messageList->msgNum = 1;
//messageList=messageList->revNext;
printSynopsis( messageList );
// End of Stage 1