c programming training institute in ambala ! batra computer centre

22
. No.: 8222066670, 4000670 Website: www.batracomputercentre.com Email : [email protected] m

Upload: jatin-batra

Post on 20-Feb-2017

11 views

Category:

Education


0 download

TRANSCRIPT

Page 1: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

Email : [email protected]

Page 2: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

C a general purpose language which is very closely associate with UNIX for which it was developed in Bell Laboratories.

Most of the programs of UNIX are written and run with the help of “C”.

Many of the important Ideas of “C” stem are from BCPL by Martin Richards.

In 1972, Dennis Ritchie at Bell Laboratories wrote C language which caused a revolution of computing world.

From beginning C was intended to be useful for busy programmers to get things done easily because C is powerful, dominant and supple language.

Page 3: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

Many of the ideas of C language were derived and taken from “B” language.

BCPL and CPL are pervious version of “B” language

As many features came from B it was named as “C”.

Page 4: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

C is a structured programming language C supports functions that enable easy

maintainability of code, by breaking large file into smaller modules Comments in provides easy readability C is a powerful language C programs built from - Variable and type declarations - Functions - Statements - Expressions

Page 5: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

Page 6: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

Before going and reading the structure of C programs we need to have a basic knowledge of the following :

1. C’s Character set2. C’s Keywords3. The General structure of a ‘C’ program4. How to end a statement 5. Free format language6. Header files and library functions

Page 7: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

A-Z all Alphabets a-z all alphabets 0-9 # % & ! _ {} [] ()

$$ && | space . , : : ‘ $

“ + - / * =

Page 8: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

“Keywords” are a word that have special meaning to the C compiler

Their meaning cannot be changed at any instance.

Serve as basic building blocks for program statements.

All Keywords are written in only lowercase

Page 9: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

Page 10: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

The files that are specified in the include section is called as header file.

these are precompiled files that has some functions define in them

We can call those fuctions in our programs by supplying parameters.

Header files is given an extension .h C source file is given an extension .c

Page 11: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

This is “ entry point’ of a program When a file is executed, the start point is the

main function From the main function the follow goes as per

the programmers choice There may or may not be other functions

written by user in a program Main function is compulsory for any C program

Page 12: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

Type a program save it Compile the program – this will generate

an .exe file Run the program In different compiler we have different option

for compiling and running.

Page 13: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

The smallest individual unit in a C program are known as tokens., In a C source program, the basic element recognized by complier is the “token” A token is source program text that the compiler does not break down into component elements.

1. Keywords2. Identifiers3. Constants4. Strings5. Special symbols6. Operators

C programs are written using these token and the general syntax

Page 14: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

A Variable is a data name that is used to store any data value

Variables are used to stores values that can be changed during the program execution

Variables in C have the same meaning as variable in algebra. That is, they represent some unknown, or variable, value.

Remember that variable in algebra are represented by a single alphabetic character

Page 15: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

Variables in C may be give representation containing multiple characters. But there are rules for these representation

Variable name in C” * May not consist of latters, digits and underscores * may not as long as you like , but only the first 31 characters are significant * may not begin with number * may not be a C reserved word * Should start with a letter or an underscore(_) * Can contain letters, number or underscores * No other special characters are allowed including space.

Page 16: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

C is case sensitive language It matters whether an identifier, such as a

variable name, is uppercase or lowercase

Page 17: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

Before using a variable, you must give the compiler some information about

the variable

The declaration statement includes the data type of the variable

Variable are not automatically initialize.

Thus, it is good practice to initialize variable when they are declered

Once a value has been placed in a variable it stays there until the program

alters it.

Page 18: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

There are three classes of data type here:• Primitive data types• Aggregate or derived data types• User defined data types

Page 19: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

/* HELLO.C -- Hello, world*/

#include <stdio.h>

Void main()

{

printf)(hello, world\n”);

Getch();

}

Page 20: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

Page 21: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com

ADDRESS: SCO -15, Dayal Bagh, Near Hanuman Mandir Ambala Cantt-133001 HaryanaPh. No.: 9729666670, 8222066670 &0171-4000670Email ID: [email protected]: www.batracomputercentre.com

Page 22: C programming Training Institute in Ambala ! Batra Computer Centre

Ph. No.: 8222066670, 4000670 Website: www.batracomputercentre.com