CE3341: C Programming 2
School | Continuing and Professional Education |
Department Code | LEARN |
Module Code | CE3341 |
External Subject Code | 100956 |
Number of Credits | 10 |
Level | L5 |
Language of Delivery | English |
Module Leader | Dr Edward Evans |
Semester | Spring Semester |
Academic Year | 2013/4 |
Outline Description of Module
The module aims to extend the student’s knowledge of the C Programming language by using more complex makefiles, dynamic allocation of memory and use of system functions to tailor the user’s environment . Topics covered include debugging a C program, use of makefiles, memory allocation and deallocation, use of database management libraries, use of environment variables inside a C program, the use of system structures to gain information from the operating system and the creation of dynamic data structures. Assessed work will include the writing of C programs.
On completion of the module a student should be able to
On completion of the module a student should be able to:
- create C programs which access Database Management (DBM) files
- create C programs which access system data structures to extract information from the UNIX operating system
- implement dynamic data structures such as a linked list
Knowledge and Understanding:
- understand the difference between internal macros and user defined macros in Makefiles
- know what the typedef statement is used for
- understand which flag has to be set in the termios data structure in termios.h to prevent echoing of characters
- understand which flags have to be set in the termios data structure in termios.h to allow raw input of characters
- know to use the Database Management (DBM) functions declared in ndbm.h to access keyed databases
- know how to extract information from the inode of a file using the stat data structure in stat.h
- know how to allocate and free memory using the malloc and free functions
Intellectual Skills:
- analyse programming requirements
- develop computer programming skills
Discipline Specific (including practical) Skills:
- use of DBM functions to create a C application which accesses a keyed database
- creation of a C program which uses the stat function to extract information about a file from the inode
- creation of dynamic data structures such as a linked list using the memory allocation function malloc
- use a Makefile with both internal and user defined macros to manage a C program with several modules
How the module will be delivered
This module includes a mix of traditional lectures and laboratory sessions.
10 meetings of 2.5 hrs. Each meeting starts with a lecture and finishes with a laboratory session.
25 contact hours.
Skills that will be practised and developed
Transferable Skills:
- analyse a programming problem and write a well-structured C program
How the module will be assessed
Formative assessment takes the form of assignments submitted to the tutor.
Summative assessment is by means of a two hour written class test.
Assessment Breakdown
Type | % | Title | Duration(hrs) |
---|---|---|---|
Written Assessment | 100 | Coursework | N/A |
Syllabus content
Internaland user defined macros in Makefiles
Use of the typedef statement to define new data types
Dynamic allocation of memory for system data structures using malloc and calloc functions
Dynamic freeing of memory using the free function
Discussion of the flags in the termios data structure and use of the tcgetattr and tcsetattr functions to set flags
Disable echoing of characters for a password by setting a flag in the termios data structure in the header file termios.h
Allow raw character input (as opposed to line input) by setting flags in the termios data structure
Use of Database Management (DBM) functions declared in ndbm.h to access keyed databases
Extracting information about a file using the stat data structure in stat.h
Use of getpwuid function to convert a User Identifier ( UID ) to a username
Use of getgrgid function to convert a Group Identifier ( GID ) to a groupname
Use of time function to get current time in seconds since 1 Jan 1970
Use of localtime function which convert a time in seconds since 1 Jan 1970 to a tm structure defined in time.h which contains fields such as hour, minute, year etc.
Creation and manipulation of a dynamic data structure such as a linked list using the malloc function
Essential Reading and Resource List
Kernighan, B.W. and Ritchie, D.M. (1988) C Programming Language . Prentice Hall.