lecture 12

The last “real” lecture. We covered everything necessary, and the remaining lectures will cover more detailed problems and in depth knowledge to help you understand C better, and make you even better programmers. You can also ask for specific topic to cover if you want?

Otherwise here are the various files we needed or made in this lecture:

And the lecture itself:

And here is a link that explains linked lists again:
Linked List in C Tutorial

Cheers Arend

This entry was posted in Uncategorized. Bookmark the permalink.

5 Responses to lecture 12

  1. cerebralFog says:

    In case anyone noticed this and was wondering why,

    The “list” file given uses a file name at run time and stores each character into a linked list. The way it is written though the last character of the file will be duplicated (at least that is what i’m seeing). After a quick search I think I know why.

    The stream gets to the last letter of the file, reads it into char C but doesn’t know we are at the end of the stream. Since it is not until fscanf() is called again that feof() knows the stream is at its end a duplicate struct is created at the end with the same character value as the last character in the stream.

    a fix to this is

    while(fscanf(F, “%c”, &C) != EOF) instead of while(!eoff(F))

    note: this assumed comparison between pointer and integer is enabled.

  2. ahnt says:

    you can also use do{ }while(!feof(F)); I suppose

  3. cerebralFog says:


    it does not have the assumption stated.

    I misread my error output. The assumption had to do with something else I was doing.


Leave a Reply