+ All Categories
Home > Documents > Welcome In The World Of

Welcome In The World Of

Date post: 20-Jan-2016
Category:
Upload: miracle
View: 31 times
Download: 0 times
Share this document with a friend
Description:
Welcome In The World Of. ‘C’. TEXT BOOK: Programming in ANCI ‘C By: E Balagurusamy. TMH Reference Books : 1) The ‘C Programming Language By: Kernighan and Ritchie. PHI Second Edition. 2) Let Us ‘C - PowerPoint PPT Presentation
Popular Tags:
33
Welcome In The World Of ‘C
Transcript
Page 1: Welcome In The World Of

WelcomeIn

TheWorld

Of

‘C’

Page 2: Welcome In The World Of

TEXT BOOK: Programming in ANCI ‘C By: E Balagurusamy. TMH

Reference Books:

1) The ‘C Programming Language By: Kernighan and Ritchie. PHI Second Edition. 2) Let Us ‘C By: Yashwant Kanitkar

Page 3: Welcome In The World Of

Teaching Scheme During a week

3 Lectures + 1 Tutorial1 Practical/Laboratory of two

hour. Marks system: Theory External Exam 60 Practical Exam / Viva 50 Internal (Avg. of 3 exams) 36 Attendance 4

Total 150

Page 4: Welcome In The World Of

Importance of Subject ‘C is the base language of any other programming language.

To be a Good Programmer one must know fundamentals of C programming language.

Page 5: Welcome In The World Of

History of ‘C’

Root of the morden language is ALGOL 1960. It’s first computer language to use a block structure.• It gave concept of structured programming.

In 1967, Martin Richards developed a language, BCPL (Basic Combined Programming Language)

Page 6: Welcome In The World Of

In 1970,by Ken Thompson created a language called as ‘B’. It used to create early version of Unix.

In 1972,by Dennis Ritchie introduced new language called as ‘C’ .

Page 7: Welcome In The World Of

1972 Traditional C Dennis

Ritchie

1990 ANSI/ISO C ISO Committee

1978 K&R C Kernighan &Ritchie

1989 ANSI C ANSI Committee

Page 8: Welcome In The World Of

It is a robust language.

Programs written in ‘C’ are efficient and fast. (Because of variety of data types and powerful operators)

Highly Portable. (related to OS)

Well suited for structured programming.

Ability to extend itself.

Features Of ‘C’

Page 9: Welcome In The World Of

Program & Programming LanguageProgram:- A Set of instructions which When carried out by processor for some Specific input, generates specific output.

Programming language:- A specific manner of writing a program with some Predefined rules, symbols & their use as a part of language. i.e. Pascal, C, C++, VC++, JAVA, VB.

Page 10: Welcome In The World Of

Basic structure of ‘C’1) Documentation Section :- It has set of comment lines(name of

program, author details). What is Comment line?? To guide a programmer. To write a note

for function,operation,logic in between a

program. Non-executable statement. Can’t be nested. e.g:- /* Hello /* abc */ Hi */ ERROR.

Page 11: Welcome In The World Of

2)Link Section :- It provides instructions to the compiler

to link function from the system library.

# include Directive:- To access the functions which are

stored in the library, it is necessary to tell the

compiler , about the file to be accessed.

Syntax:- #include<stdio.h>

stdio.h is header file.

Page 12: Welcome In The World Of

It defines all symbolic constants.

#define instuction defines value to a symbolic constant.

#define:-It is a preprocessor compiler directive, not a

statement.Therefore it should not end with a semicolon.

Generally written in uppercase.

Page 13: Welcome In The World Of

Some variables that are used in more than on function, such variables (global

variables) declared in the global declaration section.

It also declares all the user-defined function.

Page 14: Welcome In The World Of

Every ‘C’ program must have one main() function section.

It contains two parts1) Declaration part:

It declares all variables used in the executable part.

2) Executable part: It has atleast one statement.

Page 15: Welcome In The World Of

main( ) = main (void)

No arguments Explicitly indicate no

arguments

Page 16: Welcome In The World Of

Documentation section Link Section

Definition Section Global Declaration Section

main() function section {

Declaration partExecutable part

} Subprogram section

Function1Function2 … user defined function

Page 17: Welcome In The World Of

There are two ways to run programs written in a high-level language.

The most common is to compile the program

The other method is to pass the program through an interpreter.

Page 18: Welcome In The World Of

CompilerWhy compiler is require ?As machine (a processor) can operateOn binary code instruction only…..If we use higher level language then …For execution of the program we must Convert it to lower level / machine levelCode.

Page 19: Welcome In The World Of

Means, A program that translates source code into object code.The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instructions.

Interpreter:which analyzes and executes each line of source code without looking at the entire program.

Page 20: Welcome In The World Of

Advantage of interpreter:It can execute a program immediately. Compilers require some time before an executable program emerges.

But,However, programs produced by compilers run much faster than the same programs executed by an interpreter.

Page 21: Welcome In The World Of

C Compiler

- checks for syntax errors if any- on success coverts ‘C source code

into object code form – which is nearer to machine…

Page 22: Welcome In The World Of

Linker:

A linker is a program that combines object modules to form an executable program.

Page 23: Welcome In The World Of
Page 24: Welcome In The World Of

Types of languages

(I) Lower level languages:-Languages which are very near to

machine…. I.e. machine language, Assembly language.

(II) Higher level languages:- Languages which are very near to programmer rather than to machine…. I.e. C++,Visual C++,Visual basic,Java.

Page 25: Welcome In The World Of
Page 26: Welcome In The World Of

Block Diagram:Represents only

-> what should be the input?-> what will be the output?

- One need not to worry about how the result generated…. - or what will be the logic for the program?

Page 27: Welcome In The World Of

InputNo1. &

No2. PROGRAM No1 + No2

Output

Block Diagram for making addition of two numbers :

Page 28: Welcome In The World Of

AlgorithmSpecifies steps of doing the thingsIrrespective of any programming languageExample: Addition of two numbers

Step 1: [Read two numbers]Read(no1)Read(no2)

Step 2:[add two numbers into sum]summation = no1 + no2

Step 3:[Display the result]write (summation)

Page 29: Welcome In The World Of

FlowchartRepresents the flow of programSymbols:-

Start-Begin/End

Input/Output Rectangle

Process box/operation box

Decision Box

Connector

Page 30: Welcome In The World Of

Flowchart-exampleExample: To add two numbers and display the result.

Start

SUMMATION = NO1 + NO2

End

Read No1 and No2 from user

Write Summation on monitor

Page 31: Welcome In The World Of

Files:- storage of logically related data

Directory:- Placeholder which can store files

and subdirectories within them.

File Extension:- special postfix attached to each file which indicates

type of the file.

Page 32: Welcome In The World Of

/* print hello*/

#include<stdio.h> /* link section*/void main() /* execution of program*/

{print(“hello world”); /*executable

statement*/}

Page 33: Welcome In The World Of

I.e. “hello.c”, here

“hello” is filename and

“c” is file extension which

indicates that hello is a ‘c program.


Recommended