Fundamental concept of Problem solving
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
Key words
Data Types
Data Types
Primary Data Type
Secondary Data Type
Rules for constructing variables names
Variable declaration
Assigning values to variables
Scope of variables: Local & Global
Character constants
Integer constants
Real constants
Logical & String constants
C instruction set
Type Declaration & Input/Output Instructions
Arithmetic Instructions
Control Instructions
Arithmetic operators
Relational operators
Logical operators
Increment & Decrement operators
Bitwise operators
Conditional & ternary operators
The comma operators
Size of operator
Assignment operator
Type modifier
Evaluation of expression
Automatic type conversion
Basic Input/Output
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
Function and Recursion
Function Definition
Function Declaration
Function Call
Pointer expression
Pointer & functions
Pointer & Array
Multi Dimensional Arrays & Pointer
Arrays of Pointer
Use of Pointer & functions
Giving values to member
Structure Initialization
Comparison of structure variables
Arrays of structures
Arrays within structures
Structures within structures
Passing structure to function
Accessing a union member
Initialization of Union variable
Uses of Union
Dynamic Data Structure
Linked list
Data File Handling through C
File operation
Opening & closing a data file
Creating a data file
Processing a data file
Unformatted data file
C Preprocessor & Macro
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


Automatic type conversion

If the operands are of different types the lower type is automatically converted to the higher type before the operation proceeds
The result is of the higher type
Given below is the sequence of rules that are applied by evaluating expressions.
Operator 1 Operator 2 Result
Long Double any Long Double
Double any Double
Float any Float
Unsigned Long Int any Unsigned Long In
Long Int any Long Int
Unsigned Int any Unsigned Int
Final result of an expression to the type of the variable on the left of the assignment signed before assigning the value to it.
However, the following changes are introduced during the final assignment:
1. Float to Int causes truncation of the fractional part.
2. Double to float causes rounding of digits.
3. Long int to int causes dropping of the excess higher order bits
Type Casting:
Casting a value is a forcing a type conversion in a way that is different from the automatic conversion and this process is called type cast.
This should be clear from the following examples:
An example of automatic conversion:
Output of automatic conversion:
The answer turns out to be 1.000000 and not 1.5 this is because, 6 and 4 are both integers, and hence 6/4 yields an integer, 1.
This 1 when stored in a is converted to 1.000000. But what if you don't want the question to be truncated. One solution is to make either x or y as a float.
The general form of casting is:
(type_desired) expression;
where type_desired : standard C data types and
expression: constant, variables or an expression.
An example of type casting:
Output of type casting example:
Type Definition using typedef
C allows us to create data types via the typedef statement.
The format of typedef statement is:
typedef data type new_type_name;
typedef int units;
units bat1,bat2; /*this statement is equivalent to int bat1,bat2*/