Welcome to lectureWelcome to lecture
4……….4……….
//email us at:umairnsr87@gmail.com//email us at:umairnsr87@gmail.com
//contact no:09045562429//contact no:09045562429
Topics to beTopics to be
covered……..covered……..
 Compiling our first programCompiling our first program
 Introduction to variables and expressionsIntroduction to variables and expressions
 Character setCharacter set
 IdentifiersIdentifiers
 KeywordsKeywords
 VariablesVariables
 ConstantsConstants
 ExpressionsExpressions
Compiling our firstCompiling our first
program…..program…..
Introduction toIntroduction to
variables andvariables and
expressionsexpressions
Character set……..Character set……..
Data types……….Data types……….
Identifiers ……….Identifiers ……….
 In C language identifiers are the names given to variables, constants,In C language identifiers are the names given to variables, constants,
functions and user-define data. These identifier are defined against afunctions and user-define data. These identifier are defined against a
set of rules.set of rules.
 Rules for an IdentifierRules for an Identifier
 An Identifier can only have alphanumeric characters( a-z , A-Z , 0-9 )An Identifier can only have alphanumeric characters( a-z , A-Z , 0-9 )
and underscore( _ ).and underscore( _ ).
 The first character of an identifier can only contain alphabet( a-z , A-ZThe first character of an identifier can only contain alphabet( a-z , A-Z
) or underscore ( _ ).) or underscore ( _ ).
 Identifiers are also case sensitive in C. ForIdentifiers are also case sensitive in C. For
exampleexample namename andand NameName are two different identifier in C.are two different identifier in C.
 Keywords are not allowed to be used as Identifiers.Keywords are not allowed to be used as Identifiers.
 No special characters, such as semicolon, period, whitespaces, slashNo special characters, such as semicolon, period, whitespaces, slash
or comma are permitted to be used in or as Identifier.or comma are permitted to be used in or as Identifier.
 example-sum, Sum, _sum.example-sum, Sum, _sum.
Keywords………..Keywords………..
 Keywords are preserved words that haveKeywords are preserved words that have
special meaning in C language. The meaningspecial meaning in C language. The meaning
has already been described. These meaninghas already been described. These meaning
cannot be changed. There are total 32cannot be changed. There are total 32
keywords in C language.keywords in C language.
 Auto, double, int, struct, break, else, long,Auto, double, int, struct, break, else, long,
switch, case, enum , register, typedef , const,switch, case, enum , register, typedef , const,
extern, return, union, char ,float ,shortextern, return, union, char ,float ,short
,unsigned ,continue ,for ,signed ,volatile,unsigned ,continue ,for ,signed ,volatile
,default ,goto ,sizeof ,void ,do ,if, static, while.,default ,goto ,sizeof ,void ,do ,if, static, while.
Variables…….Variables…….
 a data item that may take on more thana data item that may take on more than
one value during the runtime of aone value during the runtime of a
program.program.
 Variables point to the memory locationVariables point to the memory location
which can be further changed or modifieswhich can be further changed or modifies
according to the need of program.according to the need of program.
 Declaration: int x; char a; float p;Declaration: int x; char a; float p;
Constants………Constants………
 Constants are those value which remainsConstants are those value which remains
same through out the program.same through out the program.
 They can also be defined before mainThey can also be defined before main
function by using #define pie 3.14function by using #define pie 3.14
 Eg- float pie=3.14;Eg- float pie=3.14;
To be continued inTo be continued in
lecture 5………lecture 5………
//email us//email us
at:umairnsr87@gmail.comat:umairnsr87@gmail.com
//contact no:09045562429//contact no:09045562429

Welcome to lecture 4 in c programming

  • 1.
    Welcome to lectureWelcometo lecture 4……….4………. //email us at:umairnsr87@gmail.com//email us at:umairnsr87@gmail.com //contact no:09045562429//contact no:09045562429
  • 2.
    Topics to beTopicsto be covered……..covered……..  Compiling our first programCompiling our first program  Introduction to variables and expressionsIntroduction to variables and expressions  Character setCharacter set  IdentifiersIdentifiers  KeywordsKeywords  VariablesVariables  ConstantsConstants  ExpressionsExpressions
  • 3.
    Compiling our firstCompilingour first program…..program…..
  • 4.
    Introduction toIntroduction to variablesandvariables and expressionsexpressions
  • 5.
  • 6.
  • 7.
    Identifiers ……….Identifiers ………. In C language identifiers are the names given to variables, constants,In C language identifiers are the names given to variables, constants, functions and user-define data. These identifier are defined against afunctions and user-define data. These identifier are defined against a set of rules.set of rules.  Rules for an IdentifierRules for an Identifier  An Identifier can only have alphanumeric characters( a-z , A-Z , 0-9 )An Identifier can only have alphanumeric characters( a-z , A-Z , 0-9 ) and underscore( _ ).and underscore( _ ).  The first character of an identifier can only contain alphabet( a-z , A-ZThe first character of an identifier can only contain alphabet( a-z , A-Z ) or underscore ( _ ).) or underscore ( _ ).  Identifiers are also case sensitive in C. ForIdentifiers are also case sensitive in C. For exampleexample namename andand NameName are two different identifier in C.are two different identifier in C.  Keywords are not allowed to be used as Identifiers.Keywords are not allowed to be used as Identifiers.  No special characters, such as semicolon, period, whitespaces, slashNo special characters, such as semicolon, period, whitespaces, slash or comma are permitted to be used in or as Identifier.or comma are permitted to be used in or as Identifier.  example-sum, Sum, _sum.example-sum, Sum, _sum.
  • 8.
    Keywords………..Keywords………..  Keywords arepreserved words that haveKeywords are preserved words that have special meaning in C language. The meaningspecial meaning in C language. The meaning has already been described. These meaninghas already been described. These meaning cannot be changed. There are total 32cannot be changed. There are total 32 keywords in C language.keywords in C language.  Auto, double, int, struct, break, else, long,Auto, double, int, struct, break, else, long, switch, case, enum , register, typedef , const,switch, case, enum , register, typedef , const, extern, return, union, char ,float ,shortextern, return, union, char ,float ,short ,unsigned ,continue ,for ,signed ,volatile,unsigned ,continue ,for ,signed ,volatile ,default ,goto ,sizeof ,void ,do ,if, static, while.,default ,goto ,sizeof ,void ,do ,if, static, while.
  • 9.
    Variables…….Variables…….  a dataitem that may take on more thana data item that may take on more than one value during the runtime of aone value during the runtime of a program.program.  Variables point to the memory locationVariables point to the memory location which can be further changed or modifieswhich can be further changed or modifies according to the need of program.according to the need of program.  Declaration: int x; char a; float p;Declaration: int x; char a; float p;
  • 10.
    Constants………Constants………  Constants arethose value which remainsConstants are those value which remains same through out the program.same through out the program.  They can also be defined before mainThey can also be defined before main function by using #define pie 3.14function by using #define pie 3.14  Eg- float pie=3.14;Eg- float pie=3.14;
  • 11.
    To be continuedinTo be continued in lecture 5………lecture 5……… //email us//email us at:umairnsr87@gmail.comat:umairnsr87@gmail.com //contact no:09045562429//contact no:09045562429