SlideShare a Scribd company logo
1 of 25
Programming for Problem Solving
1
Unit 1st
Module 8
C Tokens
Tokens in C
2
 A C program consists of various tokens and a
token is either a keyword, an identifier, a
constant, a string literal, or a symbol.
 Tokens are building blocks of any Programming
Language.
 Each and every smallest individual unit in a C
program is known as C tokens
C Tokens
3
Example Of Tokens
No Token Type Example 1 Example 2
1 Keyword int for
2 Constants 44 43
3 Identifier height sum
4 String "Hello" “ Bye"
5 Special
Symbol
* @
6 Operators * ++
Token Meaning
Keyword Keywords are predefined, reserved words used in programming
that have special meanings to the compile
Constant Constants are expressions with a fixed value
Identifier The term identifier is usually used for
variable names
String Sequence of characters
Special Symbol Symbols other than the Alphabets and Digits
and white-spaces
Operators A symbol that represents a specific
mathematical or non-mathematical action
Identifiers
Identifiers are the names of variables, union, function name,
structure names.
Identifier must follow some rules. Here are the rules:
 All identifiers must start with either a letter( a to z or A to Z
) or or an underscore.
 They must not begin with a digit
 Only alphabets, numbers, underscore can be used, no
other special characters, punctuations are allowed.
 A C keywords cannot be used as an identifier.
 Identifiers in C are case sensitive, foo and Foo are two
different identifiers.
 It must not contain white-space.
 It should be up to 31 characters long.
 Examples- abc, _asd, Anuj123
7
Keywords
8
 Keywords are the reserved words by the language for
special use. Every keyword has a special meaning.
Keywords are some reserved word which are not used
as an identifier by the user in the program .there are 32
keywords in C Language .following are the keywords
 Auto, else, long, switch ,break, enum, register ,case,
return ,union, char, float, short, const, for, void,
continue, goto, sizeof, default, if,static, while, do
Variables
9
 Variables are the names given to identify the
specific program elements .variable are also
called an identifier that hold some value for
processing.
 Value of a variable can be change in the
program.
 The variables represent a particular memory
location where data can be stored. They are
used to denote constants, functions, arrays,
name of files etc
 All variable must be declared before
they are used in C program. The
purpose of declaring variables is to
reserve the amount of memory required
for these variables.
 For declare any variable
 Data type Variable Name
10
Declaration of Variables
Programming for Problem Solving
11
 int san ; Here san is a variable name that hold
integer type value for processing and after the
declaration of the variable its hold 2 byte of size
in the Secondary memory
 float Area;
 char ch;
 double density ;
 int x ,y, z;
 char name [20];
 int a[10];
 When a variable is declare an address of that
variable is allocated in computer memory and
value of that variable stored on that memory
location.
Assign the value to variables:
 The variable represents some memory location
,where the data is stored. Each variable is
Associated with one or more values. The
Assignment operator = is used to assign a value of a
variable .
 Variable Name = value ;
int x = 1;
float sum = 0 .0 ;
char ch = ‘s’ ;
char ch [20] =”yash ”
12
 The constants are the identifiers which do not
change during the Execution of a program.
Programming language C allow declaring
constants variables, where value cannot be
changed. For declare a variable as a constant we
used “const” keyword before the variable name;
 const int a = 10;
 int const x = 20;
 float const pi = 3.14;
 char const ch = ‘x’;
 char const ch[20] =”sandeep” ;
13
Constants
Strings
 A string is an array of characters ended with a
null character(0).
 This null character indicates that string has
ended.
 Strings are always enclosed with double quotes(“
“).
 Let us see how to declare String in C language −
char string[20] = {‘s’,’t’,’u’,’d’,’y’, ‘0’};
char string[20] = “study”;
char string [] = “demo”;
 Collection of pre defined functions in c library.
 Header file is a file having syntax of library
functions for common use & categorized in
different set of files with .h extension.
 The header File are used to provide the
necessary information in support of the various
library functions.
 Each header file contains declaration for certain
related library functions
15
HEADER FILE
16
 For perform input output operation C provide
standard input output library . The stdio.h
header file containing all the input output
functions.
 Common input output functions are
 printf() : used for common output
 scanf() : used for common Input
 getchar() : used for character input
 putchar() : used for character output
 gets() : used for string input
 puts() :used for string output
17
Input /Output Function in C
 printf() function used to display data on the
standard output screen(Console) .The general
form of printf() function is
 Format of printf () function
 printf(“write message here that u want to
display”);
 printf ( “ format specifier” ,variable name);
 printf ( “message = format specifier” , variable
name);
18
printf ( ) function :
 scanf ( ) function :
 The scanf() function used to read the values for the
variable in a C Program from the Keyboard. The scanf ()
function used to enter the numeric, character ,decimal
and string type of data.
 scanf (“ format specifier “, &variable)
The format specifier specifies the type of the values
which are to be transfer to the variable.
 &variable : it specify the address of memory location
where the values of input variable should be stored.
 Some example of scanf ( ) function are:
 scanf(“%d”,&x);
 scanf (“%d %d ”, &x , &y);
 scanf(“%d%f”,&a, &x)
19
 printf() and scanf() function used some format specifiers for input and
output of any type of value .The Format specifiers tells the compiler
that the value of the variable should be read or write in what format. The
list of format spicifiers is:
20
Format Specifiers
Format specifier specifies the type and format of the value to
be displayed .
Some example of printf () function are:
 printf(“c is a programming language”);
//It display on the screen c is a programming language
 printf (“%d”,num);
// it display the value that is hold by the variable num and the
display value should be integer type
 printf(“%f %d” ,a , b)
// it display the value of a, b on the screen value of a is float
type and value of b is integer type
 printf (“sum =%d”,a)
// it display the value of a that is integer with message sum=
 printf(“%s” ,string)
// it display the value of the string
 printf(“%5d”,a)
// it display the total digit in a is 5 if a is 123 than it display first
two blank space then display 123.
21
 A backslash constant is a combination of two characters
backslash () and a character. The backslash constants are
used in the output function. Backslash constant are also called
Escape Sequence.
 A list of backslash constant is
22
Backslash character Constants (Escape sequences)
#include <stdio.h>
void main()
{
printf("Hello,World! ");
}
23
#include <stdio.h>
void main()
{
int a ,b, c;
a=10;
b=20;
c=a+b;
printf(“%d “,c);
}
FIRST C PROGRAM
Program to add 2numbers
#include <stdio.h> // Header
File
int main() // Main
method
{ // Main method
Body begins
int num1, num2, sum; // Variable
declration
printf("Enter two integers: "); // Display
Function
scanf("%d %d", &num1, &num2); // Input
Function
sum = num1 + num2; //
Steps for Writing and Executing a C
program
 write the C program on C Editor
 Save the program with .C extension means
filename.c
 Compile the program using CTRL+F9 Key
 Run the program using ALT+F5 key
 Executable file is created that hold program output

More Related Content

Similar to Unit 2- Module 2.pptx

C programing Tutorial
C programing TutorialC programing Tutorial
C programing TutorialMahira Banu
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingRasan Samarasinghe
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxLikhil181
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxKrishanPalSingh39
 
(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.pptatulchaudhary821
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorialMohit Saini
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxAnkitaVerma776806
 
presentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptxpresentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptxKrishanPalSingh39
 
Sample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.SivakumarSample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.SivakumarSivakumar R D .
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++K Durga Prasad
 
Reduce course notes class xii
Reduce course notes class xiiReduce course notes class xii
Reduce course notes class xiiSyed Zaid Irshad
 
C programming language for beginners
C programming language for beginners C programming language for beginners
C programming language for beginners ShreyaSingh291866
 
C presentation book
C presentation bookC presentation book
C presentation bookkrunal1210
 
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdfMANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 

Similar to Unit 2- Module 2.pptx (20)

Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
 
Ch02
Ch02Ch02
Ch02
 
(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptx
 
fds unit1.docx
fds unit1.docxfds unit1.docx
fds unit1.docx
 
presentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptxpresentation_c_basics_1589366177_381682.pptx
presentation_c_basics_1589366177_381682.pptx
 
Lecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C ProgrammingLecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C Programming
 
Sample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.SivakumarSample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.Sivakumar
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Reduce course notes class xii
Reduce course notes class xiiReduce course notes class xii
Reduce course notes class xii
 
C programming language for beginners
C programming language for beginners C programming language for beginners
C programming language for beginners
 
Input And Output
 Input And Output Input And Output
Input And Output
 
C presentation book
C presentation bookC presentation book
C presentation book
 
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdfMANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
 

Recently uploaded

RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhijennyeacort
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceSapana Sha
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...limedy534
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFAAndrei Kaleshka
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一F La
 
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degreeyuu sss
 
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxNLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxBoston Institute of Analytics
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样vhwb25kk
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一F sss
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 

Recently uploaded (20)

RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts Service
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFA
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
 
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
办美国阿肯色大学小石城分校毕业证成绩单pdf电子版制作修改#真实留信入库#永久存档#真实可查#diploma#degree
 
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxNLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 

Unit 2- Module 2.pptx

  • 1. Programming for Problem Solving 1 Unit 1st Module 8 C Tokens
  • 2. Tokens in C 2  A C program consists of various tokens and a token is either a keyword, an identifier, a constant, a string literal, or a symbol.  Tokens are building blocks of any Programming Language.  Each and every smallest individual unit in a C program is known as C tokens
  • 4. Example Of Tokens No Token Type Example 1 Example 2 1 Keyword int for 2 Constants 44 43 3 Identifier height sum 4 String "Hello" “ Bye" 5 Special Symbol * @ 6 Operators * ++
  • 5. Token Meaning Keyword Keywords are predefined, reserved words used in programming that have special meanings to the compile Constant Constants are expressions with a fixed value Identifier The term identifier is usually used for variable names String Sequence of characters Special Symbol Symbols other than the Alphabets and Digits and white-spaces Operators A symbol that represents a specific mathematical or non-mathematical action
  • 6. Identifiers Identifiers are the names of variables, union, function name, structure names. Identifier must follow some rules. Here are the rules:  All identifiers must start with either a letter( a to z or A to Z ) or or an underscore.  They must not begin with a digit  Only alphabets, numbers, underscore can be used, no other special characters, punctuations are allowed.  A C keywords cannot be used as an identifier.  Identifiers in C are case sensitive, foo and Foo are two different identifiers.  It must not contain white-space.  It should be up to 31 characters long.  Examples- abc, _asd, Anuj123
  • 7. 7
  • 8. Keywords 8  Keywords are the reserved words by the language for special use. Every keyword has a special meaning. Keywords are some reserved word which are not used as an identifier by the user in the program .there are 32 keywords in C Language .following are the keywords  Auto, else, long, switch ,break, enum, register ,case, return ,union, char, float, short, const, for, void, continue, goto, sizeof, default, if,static, while, do
  • 9. Variables 9  Variables are the names given to identify the specific program elements .variable are also called an identifier that hold some value for processing.  Value of a variable can be change in the program.  The variables represent a particular memory location where data can be stored. They are used to denote constants, functions, arrays, name of files etc
  • 10.  All variable must be declared before they are used in C program. The purpose of declaring variables is to reserve the amount of memory required for these variables.  For declare any variable  Data type Variable Name 10 Declaration of Variables
  • 11. Programming for Problem Solving 11  int san ; Here san is a variable name that hold integer type value for processing and after the declaration of the variable its hold 2 byte of size in the Secondary memory  float Area;  char ch;  double density ;  int x ,y, z;  char name [20];  int a[10];  When a variable is declare an address of that variable is allocated in computer memory and value of that variable stored on that memory location.
  • 12. Assign the value to variables:  The variable represents some memory location ,where the data is stored. Each variable is Associated with one or more values. The Assignment operator = is used to assign a value of a variable .  Variable Name = value ; int x = 1; float sum = 0 .0 ; char ch = ‘s’ ; char ch [20] =”yash ” 12
  • 13.  The constants are the identifiers which do not change during the Execution of a program. Programming language C allow declaring constants variables, where value cannot be changed. For declare a variable as a constant we used “const” keyword before the variable name;  const int a = 10;  int const x = 20;  float const pi = 3.14;  char const ch = ‘x’;  char const ch[20] =”sandeep” ; 13 Constants
  • 14. Strings  A string is an array of characters ended with a null character(0).  This null character indicates that string has ended.  Strings are always enclosed with double quotes(“ “).  Let us see how to declare String in C language − char string[20] = {‘s’,’t’,’u’,’d’,’y’, ‘0’}; char string[20] = “study”; char string [] = “demo”;
  • 15.  Collection of pre defined functions in c library.  Header file is a file having syntax of library functions for common use & categorized in different set of files with .h extension.  The header File are used to provide the necessary information in support of the various library functions.  Each header file contains declaration for certain related library functions 15 HEADER FILE
  • 16. 16
  • 17.  For perform input output operation C provide standard input output library . The stdio.h header file containing all the input output functions.  Common input output functions are  printf() : used for common output  scanf() : used for common Input  getchar() : used for character input  putchar() : used for character output  gets() : used for string input  puts() :used for string output 17 Input /Output Function in C
  • 18.  printf() function used to display data on the standard output screen(Console) .The general form of printf() function is  Format of printf () function  printf(“write message here that u want to display”);  printf ( “ format specifier” ,variable name);  printf ( “message = format specifier” , variable name); 18 printf ( ) function :
  • 19.  scanf ( ) function :  The scanf() function used to read the values for the variable in a C Program from the Keyboard. The scanf () function used to enter the numeric, character ,decimal and string type of data.  scanf (“ format specifier “, &variable) The format specifier specifies the type of the values which are to be transfer to the variable.  &variable : it specify the address of memory location where the values of input variable should be stored.  Some example of scanf ( ) function are:  scanf(“%d”,&x);  scanf (“%d %d ”, &x , &y);  scanf(“%d%f”,&a, &x) 19
  • 20.  printf() and scanf() function used some format specifiers for input and output of any type of value .The Format specifiers tells the compiler that the value of the variable should be read or write in what format. The list of format spicifiers is: 20 Format Specifiers
  • 21. Format specifier specifies the type and format of the value to be displayed . Some example of printf () function are:  printf(“c is a programming language”); //It display on the screen c is a programming language  printf (“%d”,num); // it display the value that is hold by the variable num and the display value should be integer type  printf(“%f %d” ,a , b) // it display the value of a, b on the screen value of a is float type and value of b is integer type  printf (“sum =%d”,a) // it display the value of a that is integer with message sum=  printf(“%s” ,string) // it display the value of the string  printf(“%5d”,a) // it display the total digit in a is 5 if a is 123 than it display first two blank space then display 123. 21
  • 22.  A backslash constant is a combination of two characters backslash () and a character. The backslash constants are used in the output function. Backslash constant are also called Escape Sequence.  A list of backslash constant is 22 Backslash character Constants (Escape sequences)
  • 23. #include <stdio.h> void main() { printf("Hello,World! "); } 23 #include <stdio.h> void main() { int a ,b, c; a=10; b=20; c=a+b; printf(“%d “,c); } FIRST C PROGRAM
  • 24. Program to add 2numbers #include <stdio.h> // Header File int main() // Main method { // Main method Body begins int num1, num2, sum; // Variable declration printf("Enter two integers: "); // Display Function scanf("%d %d", &num1, &num2); // Input Function sum = num1 + num2; //
  • 25. Steps for Writing and Executing a C program  write the C program on C Editor  Save the program with .C extension means filename.c  Compile the program using CTRL+F9 Key  Run the program using ALT+F5 key  Executable file is created that hold program output