Duration
4 days
What you will learn
The course fully covers the basics of programming in the “C” programming language and demonstrates fundamental programming techniques, customs and vocabulary including the most common library functions and the usage of the pre-processor.
Learning objectives To familiarize the trainee with basic concepts of computer programming and developer tools. To present the syntax and semantics of the “C” language as well as data types offered by the language.
To allow the trainee to write their own programs using standard language infrastructure regardless of the hardware or software platform.
Course Outline
Getting Started
Background
Sample program
Components of a C program
Data types
Naming conventions for variables
Printing and initializing variables
Defining arrays
Functions and Operators
Functions
Invoking functions
Elementary operators
The operator= operators
The conditional operator
Increment and decrement operators
Simple I/O
Character i/o
Handling end of file
Simple i/o examples
Redirecting standard I/O
i/o with character arrays
More On Functions
Function declarations
Returning a value or not
Function prototypes
Arguments and parameters
Organization of C source files
An extended example
Main function
The gets function
The strcmp function
The check function
The atoi function
The average function
Bit Manipulation
Defining the problem space
Readability aids
Bit wise operators
Bit wise functions
Circular shifts
Strings
Fundamental concepts
Aggregate operations
String functions
Higher Dimensional Arrays
Array dimensions
An array as an argument to a function
Arrays of strings
Structures
Fundamental concepts
Describing a structure
Creating structures
Operations on structures
Functions returning structures
Passing structures to functions
Pointers to structures
Making sense of the p -> member notation
Structures vs structure pointers
Array of structures
Functions returning pointer to structure
File I/O
System calls vs library calls
Opening disk files
Access modes
Errors in opening files
i/o library calls
Example: copying a file
Character input vs line input
Motivation for the scanf function
scanf and variants
printf variants
Closing files fclose
Servicing errors – errno
Control Flow Constructs
if statement
if else statement
while loop
for loop
Endless loops
do while loop
break and continue statements
switch statement
else if
The C Preprocessor
#define
Writing macros
#include
#ifdef
#ifndef
Separate Compilation
Compiling over several files
Function scope
File scope
Program scope
Local static
resister and extern
Object files
Libraries
The C loader
Header files
Pointers
Fundamental concepts
Pointer operators and operations
Changing an argument with a function call
Pointer arithmetic
Traversing arrays with a pointer
Traversing strings with a pointer
String functions with pointers
Relationship between array and pointer
The pointer notation *p++
Useful Library Functions
strstr - Is one string a substring
strchr, strrchr - Is a char in a string
system - Execute a command line command
strtok - Tokenize a string
strspn, strcspn - Verify string content
Math functions
Character testing functions
Appendix. Reference Tables
Important header files
printf formats
C reserved words
Conversion
Precedence charts
Do and Dont's
Theory explanation
Programme scope, delivery arrangements and suitability are confirmed during enquiry.