Introduction To C

C is a general purpose middle level language. It combines the elements of low-level with high level language. C was invented by Dennis Richie for system development works in 1970s. The UNIX operating system applications are written by C Language. C’s ability to communicate directly with hardware functions. Now it becomes professional language for various reasons:

Easy to learn

It handles low-level activities

It produces efficient programs

Structured language

It compiles the program as quickly.

C was developed from B language. C program runs in assembly language. It is often called as a structured language, because it allows user develops source code by using the defined control structure.

Storage classes

A storage class defines and show the life time of variable. There are four storage class used in C.

Auto

Register

Static

Extern

Auto storage class is a default class for variables. It can only be used in within functions. Register defines the variable that should be stored in register. It doesn’t support unary and binary operator. It is used to access the variable as quick. Static is also a default storage class for global variables. It can be defined with in a function. In this class the variable initialized at run time. Fourth class is used to declare the global variable and it gives the reference for global variables.

Variable

A variable is a storage that can hold a value or character. In C you have to create variable for each name and its types. It has two variable types that are

Local variable

Global variable

Local variable defined at the top of the block. You only must initialize the variable it yourself. Global variable is defined at the top of the program and it can change by any function. Global variable are initialized by system.

Function

A function is a block of program which performs some task. A function needs a number of parameters to perform some task and return the value. Default function does not return anything. The return keyword is used to return the value. There are two ways to pass parameters to a function.

Pass by value: it is used when you do not want to change the value of parameters.

Pass by reference: it is used when user wants to change the value of parameters.

Disadvantages

C is not object-oriented.

It has portability issues.

The compiler will stop your program from doing bad thing.

Source by Sasi Kumar S

Leave a Reply

Your email address will not be published.