Nothing Special   »   [go: up one dir, main page]

Submitted To, Name-Mr. Ankush Tandon Sir (Assistant Professor)

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 15

{

SUBMITTED TO ,
Name- Mr. Ankush Tandon Sir
(Assistant Professor)
General Aspect of ‘C’

 C was originally developed in the 1970s, by


Dennis Ritchie at Bell Telephone Laboratories, Inc.
 C is a High level , general –purpose structured
programming language .

{
C contains certain additional features that allows it
to be used at a lower level , acting as bridge
between machine language and the high level
languages.
 This allows C to be used for system programming
as well as for applications programming
The Character set of ‘C’
 C language consist of some characters set, numbers and
some special symbols. The character set of C consist of
all the alphabets of English language. C consist of :
 Alphabets a to z, A to Z
 Numeric 0,1 to 9


{
Special Symbols {,},[,],?,+,-,*,/,%,!,;,and more
The words formed from the character set are building
 blocks of C and are sometimes known as tokens. These
tokens represent the individual entity of language. The
following different types of token are used in C
 1) Identifiers 2)Keywords 3)Constants
 4) Operators 5)Punctuation Symbols
Identifiers

 A 'C' program consist of two types of elements , user


defined and system defined. Identifiers is nothing but a
name given to these elements.
 An identifier is a word used by a programmer to name a
variable , function, or label.
 Identifiers consist of letters and digits, in any order,
except that the first character or label.
 Identifiers consist of letters and digits if any order, except
that the first character must be letter.
 Both Upper and lowercase letters can be used
Keywords

auto double int struct
Keywords are nothing but
system defined identifiers. break else long switch
 Keywords are reserved
words of the language. case enum register typedef
 They have specific meaning
char extern return union
in the language and cannot
be used by the programmer
const float short unsigned
as variable or constant
names continue for signed void
 C is case senitive, it means
these must be used as it is default goto sizeof volatile
 32 Keywords in C
do if static while
Programming
Variables
 Variable is used to store the value .But it can store single value at a
time ,if we are trying to store another value then it left the first
value.
 Type Description
 char Typically a single octet(one byte). This is an integer
type.
 int The most natural size of integer for the machine.
 float A single-precision floating point value.
 double A double-precision floatin g point value.
 void Represents the absence of type.
Constants

 A constant is a value or an identifier whose value cannot


be altered in a program. For example: 1, 2.5,
 As mentioned, an identifier also can be defined as a
constant. eg. const double PI = 3.14
 Here, PI is a constant. Basically what it means is that, PI
and 3.14 is same for this program.
Operators in C:
An operator is a symbol which operates on a value or a variable. For
example: + is an operator to perform addition.

C programming has wide range of operators to perform


various operations. For better understanding of
operators, these operators can be classified as:
 Arithmetic Operators
 Increment and Decrement Operators
 Assignment Operators
 Relational Operators
 Logical Operators
 Conditional Operators
 Bitwise Operators
 Special Operators
Arithmetic Operator

 Operator Meaning of Operator


 + addition or unary plus
 - subtraction or unary minus
 * multiplication
 / division
 % remainder after
division( modulo division)
Increment and Decrement
Operators

C programming has two operators increment
++ and decrement -- to change the value of an
operand (constant or variable) by 1.
 Increment ++ increases the value by 1
whereas decrement -- decreases the value by 1.
 These two operators are unary operators,
meaning they only operate on a single
operand.
 eg. int a=10, b=100

 ++a = 11

 --b = 99
C Assignment Operators
 An assignment operator is used for assigning a
value to a variable. The most common
assignment operator is =
 Operator Example Same as
 = a=b a=b
 += a += b a = a+b
 -= a -= b a = a-b
 *= a *= b a = a*b
 /= a /= b a = a/b
 %= a %= ba = a%b
C Relational Operators
 A relational operator checks the relationship between
two operands. If the relation is true, it returns 1; if the
relation is false, it returns value 0.
 Relational operators are used in decision making and
loops.
Operator Meaning of Operator Example
 == Equal to 5 == 3 returns 0
> Greater than 5 > 3 returns 1
< Less than 5 < 3 returns 0
 != Not equal to 5 != 3 returns 1
 >= Greater than or equal to 5 >= 3 returns 1
 <= Less than or equal to 5 <= 3 return 0
Array
Function

You might also like