Upload
gautam-buddha-university
View
297
Download
2
Embed Size (px)
Citation preview
INTRODUCTION OF C LANGUAGE By
Kirti sachan
ALL ABOUT C LANGUAGE :
C is developed by Dennis Richie
C is structured programming language
Comments in c provide easy readability
C is powerful language
C is high level language with low level features
RUNNING A C PROGRAM Type a program Save it Compile it –it will be converted into exe
(executable) Run the program (the compiler checks for errors ,if any before
execution )
WHAT ARE C TOKENS AND TYPE OF C TOKENS IN C LANGUAGE
The smallest individual units in c program . They are source –program text which the compiler doesn’t furthur breakdowns.
There are 6 different types of token in c
Keywords (float,int,while etc) Identifiers(main ,amount etc) Constants ( 17.5 , -23.4 etc) Strings ( “hello” , “lets go” ) Special symbols ( {},[],& ) Operators ( +,-,*,/ )
KEYWORDS They have special
meaning to compiler They are written
only in lower case They are of great
importance in writing a c program
There are only 32 keywords available in c
CONSTANTS Constants are fixed
values which do not change during program execution
MORE ABOUT CONSTANTS
Integer constants refers to series of digit such as decimal integer ,octal integer ,
hexadecimal integer Eg : 121 ,ox2 etc Real constants The floating point constants such as -0.05 , 9.34 Single character constants It consists of single character enclosed within pair of single quotes (‘ ‘).
Eg : ‘ &’ , ‘a’ etc String constants A string constant It is a sequence of characters enclosed within double quotes (“ “ ) Eg: “ hello”
VARIABLES It is a data name used to store any value Are used to store values which can be changed
during program execution Variable names in c May only consist of letters , digits and
underscores First 31 characters are significant May not begin with a number May not be a keyword Should start with letter or underscore(_) No other special characters are allowed except
space
DATA TYPES
1. INTEGER It is a number without a fraction part Represents a signed integer of4 or 8 bytes
or32 0r 64 bit Designed to hold whole numbers Can be signed or unsigned Eg: 12 -5 7o Available in different sizeso Int , short Int and long int o Size : short int < int < long int
CHARACTER Represents a single byte of storage i.e 8 bits
of storage Used to hold characters like “d” or “a” etc Numerical value is associated with character
via a character set Numeric value of a character in memory Code: memory: Char : “place” place 67
3. FLOATING POINT It is a type of number a fractional part Designed to hold real numbers Eg 12.5 -3.4 All numbers are signed Available in different sizes float<double <
long double
4. VOID It has no values and no operations
THANK YOU Hope it was helpful