Вы находитесь на странице: 1из 15

Comprehensive C programming Training

The Course spans about 4-5 working weeks and rapidly builds from a state of no
t much acquaintance with C to a state of advanced programming .The course also
covers a large set of sorting and searching algorithms.
1.Presentation focuses on ANSI C and latest ISO c99 standards
2.Implementation dependencies for a given compiler will be studied
3.Guidelines to avoid implementation dependent results are provided
Hands on Lab work for the participants is categorized into the following four it
ems:
1.Working on the lab assignments on a daily basis.
2.Working on the implementations as documented in the detailed course coverage
below. These implementation might require assistance from the instructor
3.Implementing the behavior of some UNIX commands like:
cat, cp, mv, head,tail,cut,paste and some of the features of gre
p
4.Schedule towards the end of the training program consists of working on all th
e
1) exercises/problems from the relevant topics of the book:
The C programming Language by K&R
2) Variety of exercises involving text editor, spread sheet editors, num
eric and text processing.

Preferable platform: Linux with gcc compiler


Duration: 8 Hrs/day; 23 Days; (4 Hrs of Theory + 4 Hrs of Hands on)
A brief outline followed by detailed day wise contents are provided next:
Brief Outline
Day 1: Basics C Programming
History of C
Core language and the C library
Data types
Constants and Their types
C language keywords
Identifiers
Control Branching
if-else
Switch
while
do.. whiile
for
break and continue
Infinite loops
Labels and goto
Pitfalls with gotos
Day2: Standard I/O Functions
Arrays
Debugging C programs
Using gdb
Day3: Multidimensional arrays
Strings
Library functions for character processing
Library functions for string processing
Library functions for I/O with string target
Day4: Expressions
Operators
Operator precedence and associativity
Order of evaluation
Sequence points
Type casting
Modifiable Lvalues
Functions
Concepts of call by value and by reference
Stack frames
Variable argument list functions
Library functions for error processing
Library functions for date & time processing
Day5&6: Pointers
Invalid pointers and segmentation faults
Pointer Arithmetic
Dynamic memory allocation
Pointer to a constant Vs constant pointer
Void pointers
Arrays and pointers
Array of pointers
Pointer to array
Double pointers
Function pointers
Day 7:
Storage classes
Qualifiers and
Scope of identifiers
Linkage
Day8:
Structures and Unions
Bit fields
Offsets of the fields
Size of a structure
Optimizing on the size
Optimizing on cache memory hits
Packed and unpacked structures
Day 9&10:
File & Directory management library calls
Implementing a variety of text file processing programs
Implementing employee data base and its
operations in Text and Binary formats
Day11:
Preprocessing
Macros
File inclusion
Conditional compilations
Guidelines for developing user defined header files
Day12:
Performance & complexity analysis
Big O notation
Asymptotic behavior
Nsquare Vs Nlog N functions
Linked lists
Stacks and Queues
Application of linked lists
Expression evaluations
Polynomials
Mathematical sets
Day13: Sorting algorithms
Bubble, Insertion and Selection sorts
Merge, Quick and Heap sorts
Implementing at least 3-4 sorting algorithms
Day14:
Searching Algorithms
Linear Search
Move to the Front method
Transposition method
Hashing
Binary search
Phases of compilation
Preprocessing
Compilation
Linking
Wide characters & Multi-byte characters
The universal character set UCS
The Unicode standard
Introduction to Unicode characters of an Indian language
Introduction to UTF storage mechanism
Wide and multi-byte characters
wchar_t, definition
Wide character strings
Conversion from wide to multi-byte & multi-byte to wide characters
Library functions for wide character & string I/O
Library functions for wide character processing
Library functions for wide character string processing
Day15-18:
Completion of any pending assignments, implementations & UNIX commands
Working on the all exercises/problems from the relevant topics of the bo
ok:
The C programming language by Kernighan & Ritchie
Day 19: Implement a text file editor.

Day20: Implement mathematical and numeric processing programs


Day21: Implement the character& string processing functions and I/O functions
as they are
supported in the C-library:
Implement the variable arguments list functions support
Implement a spell check program on a text file.
Day22: Implement a spread sheet editor package
Day23: Implement the solitaire game using playing cards simulation

Detailed day wise course contents


Day1:
Basics C Programming
The objective is to provide a simple introduction to the participants not having
C acquaintance and a memory refresher to the acquainted. The focus is on C prog
ramming in UNIX environment.
History of C and its association with UNIX OS
C standards
Non-ANSI C and ANSI C, C89 and ISO C99.
Overview of the language
Core language and the C library
Structure of a C program
main() function
Declarations/Definitions
Calling library functions and including their header files
Example : strlen() with <string.h> header file.
Compiling C programs in UNIX
Automatic usage of the C library
Introduction to cross compilation
Reference to embedded systems and the need for cross compilations
Reference to simulators of embedded systems
Availability/Non availability of C library with embedded systems
Data types
Basic types and their sizes
Integer types: short, int, long and long long.
Unsigned inter types
Floating types: float, double and long double
Character types: char, signed char and unsigned char.
Limits for the numerical types as defined in the header files <limits.h
>
Optimal numeric types for a given CPU
Constants and Their types
Default types for integer constants
Octal and hexadecimal prefixes
Unsigned , long and long long suffixes
Enumeration types
Default types for floating constants
Float and long double suffixes
Hexadecimal floating constants
Character constants
Escape sequences for newline, carriage return, vertical tab ,
backspace, tab and form feed.
Octal and hexadecimal escape sequences
Basics of pointer types, arrays and strings
Associating a new name with existing types using typedef
C language keywords
Identifiers :
Definition
Rules and conventions to be followed for naming
Purpose of identifiers
Control Branching
Compound statements and Null statements
if-else staement
Switch statements
while statements
do.. whiile statements
for statements
break and continue statements
When to use each of the above statements
Infinite loops
Labels and goto statements
Scope of labels and logical problems with goto statements
Pitfalls with goto and initializations
Assignments:
Working on problems involving all the control branching statements
Exercises involving types & assignment operator with different types
Exercises with two's complement system and floating point representation
.
Day2:
Standard I/O Functions
Buffered I/O by the c library
Line buffered I/O to terminal
Char functions: getc(), putc() and ungetc()
String I/O functions: gets() and puts()
Buffer overflow with gets()
Formatted I/O functions: printf() and scanf()
Conversion specifiers for
Decimal, octal, hexadecimals and unsigned integers
Single and double precession floats
Exponent and without exponent
Characters and strings
Displaying pointer values
Length modifiers for short, long and long long types
White space separations between values
Width specifications for integers and floating types
Precession specification for floating types
Avoiding buffer overflow with scanf() for string input
Flag characters : #, 0, -, + and space
Arrays
Declaration
Initialization in C89 and in C99
Accessing elements of the array
Sizeof() with arrays and evaluating number of elements in an array
Performing I/O on integer/floating arrays
Implementing Vector addition
Implementing scalar product of vectors
Variable length arrays in C99 and their initialization
Library functions:
memset(), memcpy(), memmove() and memcmp()
Debugging C programs
Using output statements
Using gdb
Compiling with -g option: to generate symbol info in the executable code
Invoking gdb
Starting execution:
Passing command line arguments
Breakpoints
On a line in the current file
On a specific line in a specific file
On a function call
Identifying break points with a number.
Resuming execution after breaking at a break point.
Stepping into and stepping over functions
Displaying information on breakpoints
Removing breakpoints
On a line in the current file
On a specific line in a specific file
On a function call
Removing breakpoints by number
Setting Conditional breakpoints
Adding conditional checks for unconditional breakpoints
Removing the conditions for breakpoint
Enabling and disabling break points;
disable, enable, enable once and enable delete
Listing code:
Displaying lines of code using list command
Displaying definitions of function in gdb
Configuring the number of lines displayed with list command
Displaying a range of lines.
Printing:
Displaying values of variables, arrays and structure/union insta
nces
Calling functions and assigning values to variables
Displaying type information of variables, arrays and structure/u
nion instances
Displaying stack frames:of functions
Displaying a trace of all the currently active functions by disp
laying entire stack
Printing memory contents
Displaying data from a given range of memory locations in raw fo
rmat
Displaying memory contents in various formats:
octal, hexadecimal, decimal, unsigned decimal, binary,
float, address, instruction, char and string.
Using help with gdb
Repeatedly executing commands by hitting return
Abbreviations for commands in gdb.
Ex: b for break, c for continue, r for run, p for print an
dl for list.
Assigments
involving string and array I/O & processing.
Studying gdb behavior.
Day3:
Multidimensional arrays
Two dimensional arrays, array of arrays
Initialization in C89 and C99
I/O using two dimensional arrays
Implementing matrix addition and multiplication
Extending to three and multi-dimensional arrays
Implementing attendance sheet of a class with three dimensional arrays
m students, n subjects and w working days in a month
Summery report of attendance on student and subject wise listing in a mo
nth
Strings
Strings as an array of chars
Definition and storage
String literals (constant strings) and storage
Using string to initialize char pointers and char arrays
Revisiting string I/O with gets(),puts(), printf() and scanf().
Contrasting string I/O with character I/O
List of strings as a two dimensional array of chars
String I/O with two dimensional array of chars
Library functions for character processing
isalpha(), sialnum(), isdigit(),.....
toupper() and tolower()
Library functions for string processing
strlen(), strcpy(), strncpy(), strcmp ()and strncmp()
strchr(),strrchr(),strstr(), strtok(),
atoi() and atof()
Library functions for I/O with string target
Input from string with sscanf()
Output to string with sprintf() and snprintf()
Assignments
Generating ASCII table on screen
Converting the case of a string
Splitting a text line into words and displaying
Word count on a line
Calculating the frequencies of alphabets in text line
Day4:
Expressions:
Operators:
Relational
Arithmetic
logical
Assignment
Increment and Decrement
Conditional
Bit wise
Comparison of logical and bit wise operators
Special operators
Coma operator
Sizeof
Definition of [ ] operator
Type cast operator
Through study of operator precedence and associativity
Order of evaluation of expressions: left to right & right to left
Demonstration of order of evaluation with a simple yacc&lex program
Order of evaluation for &&,|| and ?: operators
Side effect operators and implementation dependencies :
Increment, decrement and assignment
Sequence points:
Effects of sequence points
List of sequence point definitions
sizeof() operator and non evaluations of side effects
Implicit type conversion in expressions and promotions
Explicit type casting
Lvalues, Modifiable Lvalues
Rvalues?
Functions
Definitions
Invocation and parameter passing
Concepts of call by value and by reference
Stack frames
Buffer over flow vulnerability in functions like gets()
Function prototypes
Void return type and void arguments
main() function specifics
Return type
Command line arguments
Recursive functions
Tail recursion
Variable argument list functions
Library functions for error processing
errno variable
perror() and strerror() functions
Library functions for date & time processing
Epoch definition
clock(),mktime() and time() funcions
asctime(), ctime() and strftime() functions
Assignments:
On expression evaluation, implementation dependencies and resolving them
.
Swap function, recursive functions
Working with date & time
Day5 &6:
Pointers
Definitions
Address space of a process in UNIX
Invalid pointers and segmentation faults
Pointers to integers & characters
Pointer initialization
Pointers into single dimensional integer and character arrays.
Pointer Arithmetic, addition and subtractions
Dynamic memory allocation with malloc() family of functions
Freeing of dynamic memory
Adjusting memory requirements, using realloc()
Allocating n elements of a given size
Pointer to a constant Vs constant pointer
Void pointers and alignment restrictions for data types
Argument types of memset() and memcpy() kind of functions
Arrays and pointers: Similarities and differences
Array of pointers
Allocating memory for pointers in the array of pointers
Pointer to array
Arithmetic of pointer to an array
Allocating memory for pointer to an array
Double pointers
Allocating memory for two dimensional array using double pointers
Assigments:
Implementing matrix addition using
a) Two dimensional array
b) Array of pointers
c) Pointer to an array
d) Double pointers
Function pointers
Definitions
Initializations
Calling functions using function pointers
Passing function as an argument to another function
Assigments:
Studying the UNIX signal call parameters
Implementing character UI menu using function pointers
Day7:
Storage classes, qualifiers and scope of identifiers
Automatic storage class
Static storage class
Register storage class
Block scope, Function scope and File (global) scope
Comparison with dynamic memory allocation
Constant and volatile qualifiers
Linkage
Symbol linkage across multiple source files
External linkage
Static linkage
A revisit of function prototypes and #include files
Assigments:
Involving code spread across multiple files
Day 8
Structures and Unions
Definitions
Creating an instance of the strucures
Initializing structure instances in C89 and in C99
The . and -> operators
Arrays of structures
Arrays in strucures
Structures in structures
Single ton structure instances
Self referencing structures and linked lists
Unions are treated with reference to the above topics on structures
Bit fields
Definitions
Memory allocation and Size of bit fields
I/O with bit fields
Offsets of the fields in a structure instance
Revisiting alignment restrictions for data types
Size of a structure
Dependence on alignment restrictions
Optimizing on the size of a structure by suitable reordering the
fields
Optimizing on cache memory hit ratio by reordering fields
Packed and unpacked structures
Implementation dependency in the language
gcc support for packed structures
Assigments:
Involving structures& unions
Studying structure size and field offsets
Days 9 & 10:
File & Directory Management in C library
Operations supported on files
Opening/Creating files
Closing the open session
Modes of opening files
File I/O functions for text data
File I/O functions for binary data
File I/O with C structures and arrays
Comparison of binary and text data in the file contents
Checking for end of file and error conditions
Seeking to a random position in the file
Deleting files
Opening. Closing and Reading directories
Assigments:
Implementation of the following programs on text data files
These programs behave similar to corresponding UNIX commands
a) Convert a file contents to upper, lower and word case
b) Counting characters, words and lines in a file
c) Displaying top few lines bottom few lines from a file
d) Generate a list of all words from the file. No duplicates allowed.
e) Generate frequencies of all the unique words from the file.
f) Displaying lines having a given word.
Support case insensitive searches
Support some of the important options of UNIX grep command
Implement a employee data base system in text format and then in binary format
files:
Support the following operations
a) Insertion
b) Modification
c) Deletion and purging records
d) Query operations
f) Reports on based on departments, on managers, on salaries
Study the advantages & disadvantages of text format Vs binary format

Day11:
Preprocessing
Concatenation of adjacent constant strings
Preprocessing directives
File inclusion
System header files
User defined header files
Macros
Object-like macros
Definitions and usage
Text replacement without any evaluation
Emphasis on the time of text replacement.
Macros with various values resulting in differing types
Predefined macros: date, time, file and line number macros
Standard C and C version macros.
Function-like macros
Definitions and usage
Working with spaces in macros definitions
Multi-line function-like macros
Differences between functions and function-like macros
Side effects with operators like ++ in argument list to macros
Guidelines to reduce the invisible side effects
# and ## operators with function-like macros
Scope of macros and undefining macros
Rescanning and further replacement of macros
Assert predefined macro
Conditional compilations
#if, #ifdef, #ifndef, #else, #elif and #endif
Debug versions of programs
Compiling for a specific OS or platform
Handling multiple inclusions of a file with conditional compilations
Line and file name control with #line directive
Compilation error messages with #error directive
Guidelines for developing user defined header files
Structure/Union tag defiitions
Functions and variable declarations
Assigments:
Involving include files, studying their location
Difference between function call and macros
Conditional compilation : generating debug and non-debug versions of exe
cutable files
Day12:
Algorithms & Abstract data structures
Algorithms definitions
Performance of algorithms
Experimental studies Vs complexity analysis
Time complexity
Space complexity
Big O, Omega and Theta notation for analysis of algorithms
Asymptotic behavior of algorithms
N square Vs N log N functions
Abstract Data Structures
Definition
Example with a linked list
Lists
Stacks and Queues
Array implementations
Linked list implementations
Complexity study
Circular queues
Linked lists
Insertion, deletion, modification and traversal
Complexity study
Circular linked lists
Doubly linked lists
Doubly linked Circular lists
Assigments:
Expression evaluations
Postfix expressions
Conversion from infix notation to post fix notation
Polynomial operations with linked lists
Sparse matrix operations with linked lists
Mathematical sets
List of linked lists for Union & intersection
Day13:
Sorting algorithms
Bubble sort
Insertion sort
Selection sort
Implement one of the above
Merge sort
Quick sort
Implement one of the above
Heap sort, building and destroying a heap
Implement heap sort
Complexity analysis of the above sorts
Assignments:
Implement 3-4 sorting algorithms from the above listed
Implementations involve sorting a set of numbers followed by sorting a s
et of strings
Day14
Searching Algorithms
Linear Search
Complexity analysis
Improvising the efficiency of linear search
Move to the Front method
Transposition method
Hashing
Hash functions
Collisions and avoidance
Splitting a list to sub-lists for hashing
Binary search
Complexity Analysis
Study the phases of compilation using the respective options from gcc
Preprocessing
compilation
linking
Wide characters& Multi-byte characters
The universal character set UCS
The Unicode standard
Introduction to Unicode characters of an Indian language
Introduction to UTF storage mechanism of the given language(U T F 16)
Definitions of wide and multi-byte characters and their differences
Wide character, wchar_t, definition
Wide character strings
Conversion from wide to multi-byte & multi-byte to wide characters
Library functions for wide character & string I/O
Char functions: getcw(), putwc() and ungetwc()
String I/O functions: fgetws() and fputws()
Formatted I/O functions: wprintf() and wscanf()
fwprintf() and fwscanf()
Library functions for wide character processing
iswalpha(), iswalnum(), iswdigit(),.....
towupper() and towlower()
Library functions for wide character string processing
wcslen(), wcscpy(), wcsncpy(), wcscmp ()and wcsncmp()
wcschr(),wcsrchr(),wcsstr(), wcstok(),
wcstol() and wcstod()
Library functions for I/O with wide character string target
Input from string with swscanf()
Output to string with swprintf()
Assignments:
Implement linear & binary searchs and hasing
Problems involving Wide char I/O and processing.(possibly on Linux with
an Indian language)
Day15 - 18:
Completion of any pending assignments, implementations & UNIX commands
Working on the all exercises/problems from the relevant topics of the bo
ok:
The C programming language by Kernighan & Ritchie
Day 19: Implement a text file editor.
Should support up to 20 lines of text each with maximum length of 80 ch
ars
Four Arrow keys support for cursor movement
Save, save as, overwrite&replace modes, search & replace ,
inserting empty lines, deleting a char, word and line ,
copy&paste operations to be supported.
Study & implement any features you like from the vi editor
Day20: Implement mathematical and numeric processing programs
Study the precession loss with storage and calculations with floating ty
pes.
Study the Maximum& minimum values of float, double and long double.
Study what data structures are best suited for the mathematical sets ope
rations:
Implement Union, Intersection, Complement, Cartesian product
Implement partitioning a set into disjoint sub sets
Implement numerical integration of simple mathematical functions using
various methods.
Implement solution of simultaneous linear equations with six variables
Day21: Implement the character and string processing functions as they are
supported in the C-library:
isalpha(), sialnum(), isdigit(),.....
toupper() and tolower()
strlen(), strcpy(), strncpy(), strcmp ()and strncmp()
strchr(),strrchr(),strstr(), strtok(),
atoi() and atof()
sprintf() for converting numeric types to strings.
memset(), memcpy() memmove(), memcmp()
Using read() & write() system calls implement the I/O functions as they
are
supported in the C-library:
putchar(), getchar(),
puts(), gets()
printf() and scanf()
Implement the variable arguments list functions support
Use pointers in to the function call stack to support the following:
Define the type va_list
Implement the macros va_start(), va_arg() and va_end() macros.
Implement a spell check program on a text file.
Allow corrections for each spelling mistake
Display the closest corrections from the system dictionary given in /usr
/share/dict/words file.
Day22:
Implement a spread sheet editor package
Should support up to 10 X 10 cells.
Strings,integers and floats to be supported for data in cells
Four arrow keys for cursor movement
Spread sheet to be stored in text format in files.
Sorting a range of cells based on primary and secondary key fields
Entire row/column deletion and insertion.
Row/column copy&paste operation
Sum of entire row/colum for numeric data fields.
Day23: Implement the solitaire game using playing cards simulation
Should support all the operations as supported by MS windows solitaire g
ame.

Вам также может понравиться