c programinng

14
By :- Rohit K. Lokhande (SYCM) Mahesh S. Trimali (SYCM)

Upload: mahi1996

Post on 17-Jul-2015

34 views

Category:

Education


0 download

TRANSCRIPT

By :-Rohit K. Lokhande (SYCM)Mahesh S. Trimali (SYCM)

“C” is called as a middle language because it allows bits & bits also & it interact with the user in English.

Computer Language

High Level

Interact with user in English.

Low Level

Use in from of bit& bits.

“C” is a programming language . The C language was first developed in 1970’s by Dennis Ritchie at AT&T Bell Labs.The origin of C is closely tied to the development of the Unix operating system.

Ken Thompson and Dennis Ritchie, developers of the C programming language.

In every programming language Data types are present . The data given by the user is different ,type of data is known as “Data Type”.Different types of data requires different amount of memory.

Data types

Integer (int)

Character (char)

Float Double

Header filesVoid main(){variable declaration

Statements;}

The following lines shows syntax for programming.

There are various operator use in “C”.

1. Arithmetic Operator

• + (Addition )• - (Subtraction)• * (Multiplication)• / (Divide)• % (modulus)

2. Relational Operator

• ‘<‘ (Less than)• ‘>’ (Grather than)• ‘<=‘ (Less than or equal to)• ‘>=‘ (Grather than or equal to)•‘=‘ (Equal to)•‘=!’ (Not equal to)

3 . Logical Operator

• ‘&&’ (Logical AND)• ‘||’ (Logical OR)• ‘!’ (Logical NOT)

4. Increment / Decrement

• ‘++’ (Increment Operator)• ‘- -’ (Decrement Operator)

Loop is a decision making statements.

In “C” there are five decision making statement.

Are as follows :-1. If-else2. While3. Switch4. Do-while5.For

Syntax :-if(condition){

statement;}else{statement;

}

Flowchart :-

Condition? Statements

Statements

False

True

Syntax :-

switch(expression){case value1:statements; break;case value2: statements;break;default;statements;break;

}

Flowchart :-

Start

case1 statements

case2 statements

Default

True

True

False

Syntax :-

initializewhile(condition)

{statements;increment / decrement;

}

Flowchart :-

Start

Initialize

Condition

Body of Loop

Increment/decrement

Stop

False

True

Syntax :-

for( initialize ; condition; increment/decrement){

body of loop//}

Flowchart :-

Start

Initialize; condition

Increment/decrement

StopTrue

False

Array is nothing but the collection of varibles,which have common data type & characteristics.

Declaration of array :-

data type array_name[capacity];

Representation of array :-

a[0] a[1] a[2] a[3] a[4] a[5]

Structure is a small body which allows user to declare variable of different data type use with the same name of the structure.

syntax :-

struct name_of_structure{

data type variable_name; // Structure member

} structure_variable;