The aim of this module is to: Expand upon the student’s basic programming skills and introduce them to more advanced features such as functions, pointers and structures. Ensure that the student fully understands exactly what happens during the compiling, linking, relocating and loading phases. Introduce the student to the link between high-level programming and the underlying operating system and/or hardware. Allow the student to write programs that can access the serial and parallel port of the PC.
Refreshing skills
Using the IDEBasic input and outputDeclarations and InitialisationsBasic OperatorsPrecedence and AssociativityBasic ArraysGood naming conventions and code layout standard including commentsFormatting the display – tabular layout etcBasic use of a GUISelection statements – if… else if … elseLoops – for, whileSolving basic engineering problems
More basic skills
More on operators – integer vs floating point arithmetic, div and mod.Basic casting and its usesThe sizeof operatorMore selection statements – switchMore loops – do…whileLogical operators and the concept of true/false in detailString processing library functionsReading/writing from/to a fileCompiling, Linking and Loading from the command prompt.Basic use of the debugger
Functions
Sub-routines (parameter-less functions)Global and local variablesBlock structure of C and scope rulesStatic local variablesauto, static and register variablesParameter variablesPass by valueFunction return valuePrototypesUsing the debugger – stepping into and stepping over functions, watching variables, breakpoints
The Ideal Machine
Introduction to a simple idealised Von-Newmann architecture machineRAM and ROMMachine codeBasic idealised Assembly code based on assembly language used in Microprocessors 1
The basics of the Compile/Link/Load process
Compiling – basic concept of translation into assembly/machine languageThe program sections and their contents – Prog, Data, Stack, HeapObject files – why compiled code cannot yet runLibrary files and pre-compiled object filesLinking – combining object files to produce a fully executable programThe symbol tableLoading in the ideal machine (no OS)
Pointers
Basic conceptDeclaration of pointer variablesThe contents of a pointer variable and the address operatorThe size of a pointer variableAccessing the value pointed to - dereferencingCall by reference in C
Arrays
Review of basic arraysPointers and Arrays and using the different syntaxesThe significance of an array namePassing an array to a function StringsCommand line arguments (argc, argv)
Structures
Advantage of structures over arraysThe structure templateCreating an instanceAccessing membersThe typedef statementProperties of structuresPointers to structuresPassing structures to functionsComplex structures – structures and arrays as members of structures
The module will be delivered through a series of lectures and lab sessions with student self-directed learning including assessment activities.
Module Content & Assessment | |
---|---|
Assessment Breakdown | % |
Formal Examination | 50 |
Other Assessment(s) | 50 |