C

Fundamental concept of Problem solving
Introduction
Problem solving strategies
Program design & implementation
Introduction to C
Introduction to C
How to open C program code window
Description of C code window
Editing File
Saving and Running a program
The components of C language
Structure of C Program
A sample of C language program
C character set and keywords
C character set and keywords
The C character set
Identifiers
Key words
Data Types
Data Types
Primary Data Type
Secondary Data Type
Variables
Introduction
Rules for constructing variables names
Variable declaration
Assigning values to variables
Scope of variables: Local & Global
Constants
Introduction
Character constants
Integer constants
Real constants
Logical & String constants
C instruction set
Introduction
Type Declaration & Input/Output Instructions
Arithmetic Instructions
Control Instructions
Operators
Introduction
Arithmetic operators
Relational operators
Logical operators
Increment & Decrement operators
Bitwise operators
Conditional & ternary operators
The comma operators
Size of operator
Assignment operator
Type modifier
Expressions
Evaluation of expression
Automatic type conversion
Basic Input/Output
Introduction
Console I/O function
Disc & Port I/O function
Control Structures
Sequence control statements
Decision control & conditional statements
Case control statements
Repitition & loop control statements
Some more statements
Array and String
Introduction of Array
Array Declaration
Array Initialization
Two Dimensional Array
Multi Dimensional Array
String
Function and Recursion
Function Definition
Function Declaration
Function Call
Recursion
Pointers
Introduction
Pointer expression
Pointer & functions
Pointer & Array
Multi Dimensional Arrays & Pointer
Arrays of Pointer
Use of Pointer & functions
Structures
Introduction
Giving values to member
Structure Initialization
Comparison of structure variables
Arrays of structures
Arrays within structures
Structures within structures
Passing structure to function
Union
Introduction
Accessing a union member
Initialization of Union variable
Uses of Union
Dynamic Data Structure
Linked list
Stack
Queue
Data File Handling through C
Introduction
File operation
Opening & closing a data file
Creating a data file
Processing a data file
Unformatted data file
C Preprocessor & Macro
Introduction
Macro substitution directives
File inclusion
Compiler control directive
Command line parameter of C
Command line parameter
Header file
Header file
Use of library functions
Some Useful library functions

Control Structures


Repitition & loop control statements

This type of statements helps the computer to execute a group of statements repeatedly.
 
This allows a set of instruction to be performed until a certain condition is reached.
 
There are three types of loops in C:
 
1. for loop
2. while loop
3. do-while loop
 
The for loop
 
There are three parts of for loop:
 
a)counter initialization.
b)check condition
c)modification of counter.
 
Syntax:
for (variable initialize; check condition; modify counter)
 
{
statements 1;
-----------;
-----------;
statements n;
}
 
Explanation:
 
1. The initialization is usually an assignment that is used to set the loop control variable.
 
2. The condition is a relational expression that determines when the loop will exit.
 
3. The modify counter defines how loop control variables will change each time the loop is repeated.
 
These three sections are separated by semicolon (;).
 
The for loop is executed as long as the condition is true. When, the condition becomes false the programe execution will resume on the statement following the block.
 
Advantage of for loop over other loops:
 
All three parts of for loop (i.e. counter initialization, check condition, modification of counter) are implemented on a single line.
 
A structure image of for loop >
 
 
An example program to print a message 5 times using for loop:
 
 
Out put of the program
 
 
Explanation of the program:
 
The o/p will be in the loop 1 time, 2times till 5 times.
 
Something more about for loop:
 
1. for (p=1,n=2;n<17;n++):- we can assign multiple variable together in for loop.
 
2. for (n=1,m=50;n<=m;n=n+1,m=m-1):-The increment section may also have more than one part as given.
 
3. for (i=1,sum=0;i<20&&sum<100;++i):-The test condition may have any compound relation as given.
 
4. for (x=(m+n)/2;x>0;x=x/2):-It is also permissible to use expressions in the assignment statements of initialization and increment section as given.
 
5. for (;m!=100;):-we can omitted the initialization and increment section to set up time delay.
 
while loop
 
It is a primitive type looping control because it repeats the loop a fixed no. of time. It is also called entry controlled loop statements.
 
Syntax:
 
while (test_condition)
{
body of loop
}
 
Explanation:
 
The test condition is evaluated if the condition is true, the body of loop will be executed.
 
A structure image of while >
 
 
An example of program to print the number 1 to 10 using while loop:
 
 
Out put of the program
 
 
The do-while loop
 
The minor Difference between the working of while and do-while loop is the place where the condition is tested.
 
The while tests the condition before executing any of the statements within the while loop
 
As against this, the do-while loop tests the condition after having executed the statement within the loop.
 
syntax:
 
do
{
body of loop;
}
while (test condition);
 
A structure image of do-while loop >
 
 
Explanation:
 
It first executes the body of the loop, and then evaluates the test condition. If the condition is true, the body of loop will executed again and again until the condition becomes false.
 
Example of program using do-while loop:
 
 
Out put of the program
 
 
Explanation of the program:
 
First it will print "hello there" then it will go for condition statements.