>

Thursday, March 24, 2011

C PROGRAMMING TUTORIAL

LESS THEORIES MORE CONCEPTS

Over view of C:

C was developed by dennis ritche.

Structured language……………..etc………

We don't need the features, founder, history of c , bla , bla stories yeah.

Let go to the concepts:

FUNCTION:
        
An block {} of code that executed behind the control of user.

COMPIPLER:


An System software that converts user code into the machine readable, as a whole.

INTERPRETER :


System software that converts the user coding into machine code line by line.

In c programming we are going to use only compiler, not interpreter.

Sample program:

#include<stdio.h> // inserts header file called standard input output.h

Void main() // main function name

{ // function starts

Printf(" No keyboard found…….press F1 for help…"); // printing some texts to the output window

} // end of the function

Let us Explain:

#include-> it is the preprocessor which is used to inserts the header file into our program.

In c programming language we have 15 header files as defines by ANSI. Each header file

Has the own library function.

Stdio.h-> standard input and output header file which is used to the function named PRINTF .

The printf used to display some text to the output window which is double quoted within braces.

("some text here")

In c program each line should be ended with semicolon (;).
It tells the compiler you are at end of the line.

KEYWORDS: Keywords are the reserved words within the c program which has the default meaning

It cannot be changed by the user. Generally C has the 32 keywords. They are

C89:

Auto break case char const continue default do double else enum extern float

for goto long if Int return register sizeof static struct switch signed short typedef

union unsigned Void volatile while.

Keywords added by C99:

_bool, _imaginery, _complex, restrict, inline.

IDENTIFIER:
Identifier means the symbols, names variables used for user identification.

Rules for identifiers:

  1. They should not exceed 31 characters long.
  2. They should not starts with number or underscore.
  3. They will be not as same keyword.

DATATYPE:

To use data in our program we need to separate it from collision. Datas are categorized

In c program four formats.

Int-> rounded decimal value.

Float-> decimal value with precisions.

Double-> decimal value more than two or three precisions.

Char-> text only.

Every data type is holding bits as their own based on the processor and compiler.

VARIABLES:

Variables are the identifiers declared in c program for future use within the program.

They are divided in two types. Global variables-> which is declared before the function

Is created. Local variables-> Within the main function.