what is c? c is a programming language. it was developed in 1972 usa. it was designed and written by...

18
What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all computer languages like C++, java etc. Major parts of popular operating systems like Windows, UNIX, Linux are still written in C.

Upload: chastity-harper

Post on 05-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

What is C?

C is a programming language.It was developed in 1972 USA.It was designed and written by a man named

dennis ritchie.C is the base for all computer languages like

C++, java etc.Major parts of popular operating systems like

Windows, UNIX, Linux are still written in C.

Page 2: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

Getting Started with C

Communicating with a computer involves speaking the language the computer under stands.

As in learning of English language first we learn English alphabets, which forms a word, words combine to form a sentence and sentences forms a paragraph.

Like English language we must have to learn alphabets, numbers and symbols which are used in C.

Page 3: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

Steps in learning English language

Alphabets

Words

Sentences

Paragraphs

Page 4: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

Steps in learning C

Alphabets, Digits, Special symbol

Constants, Variables, Keywords

Instructions

Programs

Page 5: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

The C character Set

A character denotes any alphabet, digit or special symbol used to represent information.

Page 6: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

Alphabets

Digits

Special symbols

A,B,….,Y,Z

a,b,….,y,z

0,1,2,3,4,5,6,7,8,9

~ ` ! # @ % ^ & *

( ) _ - + = I { } [ ] : ; “ < > , . ? /

Page 7: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

Constants, Variables and Keywords

The alphabets, numbers and special symbols when properly combine form constants ,variables and keywords.

Any entity that doesn`t change is called constant.

Any entity that may change is called variable.

Page 8: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

3 5X X

3 is stored in a memory location and a name X is given to it. we assign a new value 5 to thesame memory location X. So the location X canHold different values. 3 and 5 cannot change.

Page 9: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

Types of C constants

C constants can be divided into two major categories:

(a) Primary constants(b) Secondary Constants These are further categorized as

Page 10: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

Interger Constant

Real Constant

Character constant

SecondaryConstants

ArrayPointer

StructureUnion

Enum. etc.

PrimaryConstants

C Constants

Page 11: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

Rules for constructing Integer constants

(a) An integer constant must have at least one digit.(b) It must not have a decimal point.(c) It can be either positive or negative.(d) If no sign precedes an integer constant, it is

assumed to be positive.(e) No commas or blanks are allowed within an

integer constant.

Page 12: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

(f) The allowable range for integer constants is -32768 to 32767.The range of integer constant depend upon

the compiler. for a 16-bit complier like Turbo C or Turbo C++ the range is -32768 to 32767. working with a 16-bit complier

Ex: 426 +782 -8000 -7605

Page 13: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

Rules for Constructing Real Constants

Real constants are often called Floating Point constants.

It may be in fractional and Exponential form.

Following rules must be followed for constructing real constants expressed in fractional form:

Page 14: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

(a)A real constant must have at least one digit.(b) It must have a decimal point.(c) It could be either positive or negative.(d) Default sign is positive.(e) No commas or blanks are allowed within a real constants. Ex:+325.34 426.0 -32.76 -48.5792

Page 15: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

The exponential form of representation of real constants is usually used if the value of the constant is either too small or too large.

The real constant is represented in two parts . The part appearing before “e” is called mantissa and the part following “e” is called exponent.

0.000342 can be represented in exponential form as 3.42e-4.

Following rules must be observed by constructing constants expressed in exponential form:

Page 16: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

(a) The mantissa part and the exponential part should be separated by a letter e or E.(b) The mantissa part may have a positive or

negative sign.(c) Default sign of mantissa part is positive.(d) The exponent must have at least one digit,

must be a positive or negative integer. Default sign is positive.

(e) Range of real constants expressed in exponential form is -3.4e38 to 3.4e38.

Ex: +3.2e-5 4.1e8 -0.2E+3 -3.2e-5

Page 17: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

Rules for constructing Character Constants

(a) A character constant is a single alphabet, single digit or a single special symbol enclosed within single inverted commas. Both the inverted commas should point to the left. For example `a` is a valid character constant whereas `A` is not.

(b) The maximum length of a character constant can be 1 character.

Ex: `A` `I` `5` `=`

Page 18: What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all

The End