Advertisement

Saturday 28 July 2012

C-programming concepts(continued..)

    C-programming concepts(continued..)

         1.9 VARIABLES


           It is a data name used for storing a data value. Its value may be changed during the program
              execution. The value of variables keeps on changing during the execution of a program.



1.12 INPUT AND OUTPUT

Reading data from input devices and displaying the results on the screen are the two main
tasks of any program.
Formatted Functions
— The formatted input/output functions read and write all types of values
Input                                                                     Output
Scanf()                                                                  printf()

Unformatted Functions
The unformatted input/output functions only work with the charcter data type
Input                                                                     Output
getch()                                                                  putch()
getche()                                                               putchar()
getchar()                                                                put()
gets()

1.13 DECISION STATEMENTS

It checks the given condition and then executes its sub-block. The decision statement decides
the statement to be executed after the success or failure of a given condition.

Types:

1. If statement
2. If-else statement
3. Nested if-else statement
4. Break statement
5. Continue statement
6. Goto statement
7. Switch() statement
8. Nested switch ()case
9. Switch() case and Nested if




1.14 LOOP CONTROL STATEMENTS

Loop is a block of statements which are repeatedly executed for certain number of times.
Types
1. For loop
2. Nested for loops
3. While loop
4. do while loop
5. do-while statement with while loop




1.15 ARRAYS

It is a collection of similar data types in which each element is located in separate memory
locations.

Types

1. One dimensional array
2. Two dimensional arrays
3. Three or multi dimensional arrays


Operations


1. Insertion
2. Deletion
3. Searching
4. Sorting
5. Merging








































1.17 FUNCTIONS

It is a self-contained block or a sub program of one or more statements that performs a
special task.

Declaration of functions

Function_name (argument/parameter)
Argument declaration;
{
Local variable declaration;
Statement1;
Statement 2;
Return (value);
}

Call by value

In this type, value of actual arguments is passed to the formal arguments and the operation is
done on the formal arguments. Any change made in the formal argument does not effect the actual
arguments because formal arguments are photo copies of actual arguments.

Call by reference

In this type, instead of passing values, addresses are passed. Function operates on address
rather than values. Here the formal arguments are pointers to the actual argument.

1.18 RECURSION

A function is called repetitively by itself.