1. Tutorial on C Concepts & Statements
An escape sequence is a sequence of characters that does not represent itself when used inside a character or string literal. Conditional Operator returns the statement depends upon the given expression result. The run-time stack is a stack of activation records. Activation records keep track of the local variables. Storage Classes are used to describe about the features of a function. Linkage of any variable and/or function defines the Area of the Program in which they are accessible. A scope is a region of the program, and the scope of variables refers to the area of the program where the variables can be accessed after its declaration. The following section gives a collection of C Tutorials which are categorized into various Categories like Programs on Escape Sequences, Run-time Stack, Conditional Statements with Examples, While, For and Do-While Loop Statements, Storage Classes, Linkage & Scope of Variables.
2. Tutorial on C Operators and Expressions
C programming has various operators to perform tasks including arithmetic, relational, conditional, logical and bitwise operations. Relational operators are used for comparison of the values of two operands. Logical Operators are used to combine two or more conditions. Bitwise operators is used to perform bit-level operations on the operands. Assignment operators are used to assign value to a variable. Cast is a special operator that forces one data type to be converted into another. Unary operators that act upon a single operand to produce a new value. sizeof operator is used to calculate the size of data type or variables. This section contains C programs on Operators like arithmetic, relational, conditional, logical and bitwise operations, sizeof Operator, Unary Operators and Cast Operator.
3. C Pointers Tutorial
Pointer is a variable which contains the address in memory of another variable. The rules for assigning one pointer to another are tighter than the rules for numeric types. NULL Pointer is a pointer which is pointing to nothing. When a pointer holds the address of another pointer then such type of pointer is known as pointer-to-pointer or double pointer. Lvalue refers to some location or storage used by some data object. This section contains C programs on Pointers, Operators addressof, Pointers with Modular Programming, Pointer Compatibility, Pointer Expressions, NULL Pointer and Double Pointer.
4. C Functions Tutorial
Parameters which are passed in the function call are known as actual parameters or actual arguments. Parameters which are received by the called function are known as formal parameters or formal arguments. Function is a block of statements, which is used to perform a specific task. Process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called as recursive function. The following section contains C programs on functions, integral components, actual and formal arguments, ADTs and black boxes Context, recursion and iterator.
5. Tutorial on C Arrays
An array is collection of items stored at continuous memory locations. One Dimensional Arrays is a fixed sequenced collection of elements of the same data type. Subscript operator, ‘’, which aside from having higher precedence than indirection operator (*) is same as indirection operator. So, subscripts in arrays perform indirection or dereferencing. An array with more than one dimension is called a multidimensional array. strlen() function primarily a string handling function used with strings and always returns actual no. of characters in the string without counting on NULL byte. This section contains C Programs on Arrays, one-dimensional array, array subscripts, pointers, functions, strlen() function and multidimensional arrays.
6. Characters & Strings Tutorial
Character constants are used to represent characters in the execution character set. Char values are stored in 1 byte, and are encoded as numbers using the ASCII encoding. Strings are actually one-dimensional array of characters terminated by a null character. Strings in C comprise of individual parts separated by one or more characters called delimiters. These individual parts are called tokens. In order to process these individual parts, they have to be extracted from the string. strtok() isolates these parts, discards the delimiters and NULL terminate them. Command line argument is a parameter supplied to the program when it is invoked. The following section contains C programs on type size_t, null characters, strings, strtok() function, libc functions, memory functions and command-line arguments.
7. Structures & Unions Tutorial
Structure is a user defined data type. Structure is the collection of variables of different types under a single name for better handling. Union is a data type that allows to store different data types in the same memory location. Two structures, for example, say A and B, are called mutually dependent if one of members of each refers to other structure. Self Referential Structure is the Data Structure in which the pointer refers to the structure of the same type. Structure written inside another structure is called as Nested structure. Bit fields are declared as other structure declarations with difference that member’s are fields of one or more bits. This section contains programs on structures like self referential structure, mutually dependent and nested structures, bit fields and union.
8. Tutorial on Dynamic Memory Allocations in C
The process of allocating memory at runtime is known as dynamic memory allocation. Free Store is a pool of un-allocated heap memory given to a program that is used by the program for dynamic allocation during the execution of program. malloc() function is used to allocate space in memory during the execution of the program. calloc() function is used to allocate storage to a variable while the program is running. realloc() function is used to resize allocated memory without losing old data. The following section contains C Programs on compile time and runtime memory allocation, pool of free memory, malloc(), calloc(), realloc(), free() and memory leak.
9. Structures & Pointers Tutorial
Linked list is an ordered set of data elements, each containing a link to its successor. A linked list that can only be traversed in forward direction is called a singly linked list. A singly linked list is traversed from beginning through till end using the root pointer. root contains the address of start of list. Singly linked list in which values are inserted in either ascending or descending order is called an ordered singly linked list. In unordered list we shall insert new value at the end of the list. A singly liked list can be traversed in one and in Forward Direction only while doubly linked list in either Forward or Backward direction. The following section contains C programs on linked list, singly liked list, doubly linked list, ordered and unordered singly linked lists.
10. Tutorial on Advanced Pointers
A pointer is a variable that holds address, address of a variable of any basic types, address of a structure, address of an array or address of some other pointer variable. Function pointer can be passed as an argument and can also be returned from a function. Function calls back user’s function is called callback function. jump table is a method of transferring program control to another part of a program using a table of branch or jump instructions. A string literal is a sequence of characters terminated by null byte ‘0’. This section contains C programs on pointer to pointer, pointer to function, callback functions, jump tables, command line arguments and string literal operations.
11. C Pre-Processor Tutorial
Preprocessor is just a text substitution tool and it instructs the compiler to do required pre-processing before the actual compilation. #define is a C preprocessor directive used to define macros. Macros is a process where an identifier in a program is replaced by a predefined string or value. File inclusion makes it easy to handle collections of #defines and declarations. The null directive is a line with a pound sign but contains nothing else. These directives are simply deleted by the preprocessor. “##” construct can be used in the replacement text of function like macro or object like macro. This macro combines two tokens on either side of it into a single token called an identifier. This section contains C programs on preprocessor & its directives, #define directive, macros, file inclusion and nested file inclusion.
12. Tutorial on File I/O Handling in C
ANSI C implementations include library in specification. Standard dictates a mandated set of functions, which have required interface and they operate in prescribed manner. perror() displays a message on stderr describing the most recent error that occurred during a library function call or system call. Text streams may have certain characteristics that may vary from system to system. fopen() function is used to open a given file and associates a stream with the file. ungetc() returns previously read character back to the stream so that it could be read again. clearerr function clears the error and end-of-file indicators for the stream pointed to by stream. The following section contains C programs on ansi c implementation, perror() and exit() function, text and binary streams, binary i/o, stream error and manipulation functions.
13. Tutorial on Standard C Library
C Standard Library is a set of C built-in functions, constants and header files. Signals are mechanisms for communicating with and manipulating processes. A function that handles signals is called a signal handler. abort() function terminates execution of a program abnormally. It’s defined in ‘stdlib.h’ header. assert() is a macro therefore it doesn’t have a prototype. system() function is used to execute shell commands which we can’t use directly in c programs. qsort() function is used to sort an array of values in ascending order. bsearch() function is used to locate a given value in a sorted array using binary search mechanism. This section contains C programs on standard library functions, pseudo random numbers, signal handlers, getenv() and abort() functions, locale, qsort() and bsearch() functions.
14. Tutorial on C Runtime Environment
The runtime environment implements the execution model, built-in functions, and other fundamental behaviors of a programming language. Function prologue is part of function does all work needed to start up the function. It begins by reserving space for local variables and other values on the runtime stack. Function epilogue cleans up the stack frame just before function is done and returns to the caller. Stack frame is the area on stack which function uses to store local variables and other values. The following section contains C programs on runtime environment limits, function prologue and epilogue, stack frame, function prototypes, frame and stack pointers.
Wish you the best in your endeavor to learn and master C programming language!