SlideShare a Scribd company logo
Fundamentals of C
C TOKENS
• Tokens are the smallest individual units of a c program. There are six types of tokens in c language as shown in
following figure :-
Fundamentals of C
KEYWORDS AND IDENTIFIERS
• Every C word is defined as either keyword or an identifier.
• A keyword is a word or phrase which has fixed meaning and its meaning cannot be changed.
• Keywords serve as basic building blocks for program statement. The list of C keywords are listed in below Table :-
Table – C Keywords
Fundamentals of C
KEYWORDS AND IDENTIFIERS
• Identifiers refers to the name of variables, functions and arrays.
• These are user-defined names and consist of a sequence of letters and digits, with a letter as a first character.
• Both uppercase and lowercase letters are permitted; lowercase letters are used very frequently.
• Underscore character is used as identifier also and it used as link to connect two words in long identifiers.
• There are following rules to define an identifier :-
1. First character must be an alphabet ( or underscore ).
2. An identifier must consist of only letters, digits or underscore.
3. Only first 31 characters are considered significant.
4. An identifier must not contain white space.
Fundamentals of C
CONSTANTS
• Constants in C language refers to fixed values that do not change during the execution of a program.
• C language has several types of constants as shown in following figure :-
CONSTANTS
NUMERIC
CONSTANTS
CHARACTER
CONSTANTS
INTEGER
CONSTANTS
REAL
CONSTANTS
SINGLE CHARACTER
CONSTANTS
STRING
CONSTANTS
Fig : Basic Types of C constants
Fundamentals of C
CONSTANTS
• Integer Constants -
1. Integer constants refer to a sequence of digits.
2. There are following three types of integers :-
I. Decimal Integers -
• Decimal integer consists of a set of digits , 0 through 9, preceded by an optional – or + sign.
• Examples :- 123 -321 0 654321 +78
• Embedded spaces, commas, and non-digit characters are not permitted between digits .
For example, 18 750 20,000 $1000 are illegal numbers.
II. Octal Integers –
• An octal integer constant consists of any combination of digits from the set 0 through 7, with a
leading 0. Some examples of octal integer are : 037 0 0435 0551
III. Hexadecimal Integers –
• A sequence of digits preceded by 0x or 0X is considered as hexadecimal integers.
• They may also include alphabets A through F or a through f , the letter A through F represent the
numbers 10 through 15.
• Examples :– 0X2 0x9F 0Xbcd 0x
Fundamentals of C
CONSTANTS
• Real Constants –
1. Integer numbers are not sufficient to represent quantities that vary continuously, such as distances, heights,
temperatures, prices, and so on.
2. These quantities are represented by numbers containing fractional parts like 17.584.
3. Such numbers are called real ( or floating point ) constants.
4. Examples :- 0.0083 -0.75 435.36 +84.0 0.65e4 12E-2
5. Real Constants can be expressed in following two types of notations :-
I. Decimal Notation :- 215.15 210. -.71 +.5 +85.0 -112.5
II. Exponential ( Scientific ) Notation :-
• mantissa e exponent
• 0.5e4 18e-2 1.5e+5 3.18E3 -1.2E-1
• This notation is useful to represent which are very large or small in magnitude. For example,
85000000000 can be written as 8.5E10 or 85E9
• Similarly 0.000000036 is equivalent to -3.6E8
6. These constants are normally represented as double-precision quantities . Suffix f or F is used to force single
digit precision and l or L is used to force double digit precision further.
Fundamentals of C
CONSTANTS
• Single Character Constants –
1. A single character constant (or simply character constant) contains a single character enclosed within a pair of
single quote marks.
2. Example:- ‘5’ ‘a’ ‘A’ ‘;’ ‘ ‘
• String Constants –
1. A string constant is a sequence of characters enclosed in double quotes. The characters may be letters,
numbers, special characters and blank space.
2. Example :- “Hello!” “2020” “GOOD MORNING” “?.......!” “5+3” “X”
Fundamentals of C
VARIABLES
• A variable is nothing but a name given to a storage area that our programs can manipulate.
• Unlike constants that remain unchanged during execution of program, a variable may take different values at different
times during execution of program.
• Each variable in C has a specific type, which determines the size and layout of the variable's memory; the range of
values that can be stored within that memory; and the set of operations that can be applied to the variable.
• A variable name may consist of letters, digits, and the underscore(_)character, subject to the following conditions :-
1. They must begin with a letter. Some systems permits underscore as the first character.
2. Standard length for a variable name is 31 characters. However length should not be more than eight characters,
since only first 8 characters are treated as significant by many compilers.
3. Uppercase and lowercase are significant i.e. the variable Total is not same as total or TOTAL.
4. It should not be a keyword.
5. White space is also not allowed
• A variable name can be chosen by the programmer in a meaningful way so as to reflect its function or nature in the
program. Example :- Average, height, Total, Counter_1, class_strength, distance, ph_value, mark.
• Some Invalid examples of variables are 123 (area) % 25th
Fundamentals of C
DATA TYPES
• Data types refers to an extensive system used for declaring variables or functions of different types.
• Data types specify how we enter data into our programs and what type of data we enter.
• The type of a variable determines how much space it occupies in storage and how the bit pattern stored is
interpreted. This determines the type and size of data associated with variables.
• Each data type requires different amounts of memory and has some specific operations which can be performed over
it.
• There are three classes(types) of data types :
1. Primary (or fundamental) data types
2. Derived data types
3. User-defined data types
Fundamentals of C
DATA TYPES
1. Primary (or fundamental) data types –
• Every C compiler supports following types of primary data types :
Fig : Primary data types in C
l
Fundamentals of C
DATA TYPES
1. Primary (or fundamental) data types –
I. Integer Types –
• Integers are whole numbers with a range value supported by a particular machine.
• Integers are defined in C by the keyword int.
• Generally integers occupy one word of storage, and since the word sizes of machines vary (typically 16 ,32 or 64 bits) the
size of an integer that can be stored depends on the computer.
• If 16 bit word length is used , the size of the integer value is limited to the range -32768 to +32767(that is,
−215
𝑡𝑜 +215
−1.
• For 32 bit machine the range id -2,147,483,648 to 2,147,483,647.
• A signed integer uses one bit for sign and 15 bits for the magnitude of the number .
• C language has 3 classes of integer storage, namely short int, int, and long int, in both signed and unsigned forms.
Unlike signed integers , unsigned integers use all the bits for magnitude of the number and are always positive.
• We use long and unsigned integers to increase the range of values.
Fundamentals of C
DATA TYPES
1. Primary (or fundamental) data types –
II. Floating Point Types –
• Floating point numbers are stored in 32 bits ( on all 16 bits and 32 bits machines), with 6 digits
precision.
• Floating point numbers are defined in C by the keyword float.
• When the accuracy provided by a float number is not sufficient, the type double can be used to
define the number.
• A double data type number uses 64 bits giving a precision of 14 digits. These are known as
double precision numbers.
• To extend the precision further, we may use long double which uses 80 bits.
float
double
long double
Fundamentals of C
DATA TYPES
1. Primary (or fundamental) data types –
III. Character Types –
• A single character can be defined as a character(char) type data.
• Characters are usually stored in 8 bits (one byte) of internal storage.
• The qualifier signed or unsigned may be explicitly applied to char.
• While unsigned chars have values between 0 and 255, signed chars have values from -128 to 127.
IV. Void Types –
• The void type has no values.
• This is usually used to specify the type of functions. The type of a function is said to be void when it does
not return any value to the calling function .
Fundamentals of C
DATA TYPES
1. Primary (or fundamental) data types –
Table : Size and Range of Data Types on 16-bit machine
Fundamentals of C
DATA TYPES
2. Derived data types –
• C supports three derived data types :-
Fundamentals of C
DATA TYPES
3. User-defined data types –
• C supports the feature called type definition which allows the programmer to define their identifier that would
represent an existing data types. There are three such data types:

More Related Content

What's hot

What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programming
Rumman Ansari
 
Constant and variacles in c
Constant   and variacles in cConstant   and variacles in c
Constant and variacles in c
yash patel
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
programming9
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
Chitrank Dixit
 
C language (more)
C language (more)C language (more)
C language (more)
marar hina
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
Way2itech
 
Bsc cs i pic u-2 datatypes and variables in c language
Bsc cs i pic u-2 datatypes and variables in c languageBsc cs i pic u-2 datatypes and variables in c language
Bsc cs i pic u-2 datatypes and variables in c language
Rai University
 
Mca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c languageMca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c language
Rai University
 
Btech i pic u-2 datatypes and variables in c language
Btech i pic u-2 datatypes and variables in c languageBtech i pic u-2 datatypes and variables in c language
Btech i pic u-2 datatypes and variables in c language
Rai University
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
 
Variables and data types in C++
Variables and data types in C++Variables and data types in C++
Variables and data types in C++
Ameer Khan
 
Diploma ii cfpc u-2 datatypes and variables in c language
Diploma ii  cfpc u-2 datatypes and variables in c languageDiploma ii  cfpc u-2 datatypes and variables in c language
Diploma ii cfpc u-2 datatypes and variables in c language
Rai University
 
Data type
Data typeData type
Data type
Isha Aggarwal
 
C Tokens
C TokensC Tokens
C Tokens
Ripon Hossain
 
C Slides
C SlidesC Slides
Data type in c
Data type in cData type in c
Data type in c
thirumalaikumar3
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
Hassan293
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variables
eShikshak
 
Chapter 13.1.1
Chapter 13.1.1Chapter 13.1.1
Chapter 13.1.1
patcha535
 
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constants
vinay arora
 

What's hot (20)

What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programming
 
Constant and variacles in c
Constant   and variacles in cConstant   and variacles in c
Constant and variacles in c
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 
C language (more)
C language (more)C language (more)
C language (more)
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
 
Bsc cs i pic u-2 datatypes and variables in c language
Bsc cs i pic u-2 datatypes and variables in c languageBsc cs i pic u-2 datatypes and variables in c language
Bsc cs i pic u-2 datatypes and variables in c language
 
Mca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c languageMca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c language
 
Btech i pic u-2 datatypes and variables in c language
Btech i pic u-2 datatypes and variables in c languageBtech i pic u-2 datatypes and variables in c language
Btech i pic u-2 datatypes and variables in c language
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Variables and data types in C++
Variables and data types in C++Variables and data types in C++
Variables and data types in C++
 
Diploma ii cfpc u-2 datatypes and variables in c language
Diploma ii  cfpc u-2 datatypes and variables in c languageDiploma ii  cfpc u-2 datatypes and variables in c language
Diploma ii cfpc u-2 datatypes and variables in c language
 
Data type
Data typeData type
Data type
 
C Tokens
C TokensC Tokens
C Tokens
 
C Slides
C SlidesC Slides
C Slides
 
Data type in c
Data type in cData type in c
Data type in c
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variables
 
Chapter 13.1.1
Chapter 13.1.1Chapter 13.1.1
Chapter 13.1.1
 
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constants
 

Similar to Constants variables data_types

Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introduction
nikshaikh786
 
Constants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya JyothiConstants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya Jyothi
SowmyaJyothi3
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
Mohit Saini
 
All C ppt.ppt
All C ppt.pptAll C ppt.ppt
All C ppt.ppt
JeelBhanderi4
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_output
Anil Dutt
 
CONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN CCONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN C
Sahithi Naraparaju
 
Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++
Ankur Pandey
 
Data types slides by Faixan
Data types slides by FaixanData types slides by Faixan
Data types slides by Faixan
ٖFaiXy :)
 
COM1407: Variables and Data Types
COM1407: Variables and Data Types COM1407: Variables and Data Types
COM1407: Variables and Data Types
Hemantha Kulathilake
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
Rai University
 
PSPC--UNIT-2.pdf
PSPC--UNIT-2.pdfPSPC--UNIT-2.pdf
PSPC--UNIT-2.pdf
ArshiniGubbala3
 
FUNDAMENTAL OF C
FUNDAMENTAL OF CFUNDAMENTAL OF C
FUNDAMENTAL OF C
KRUNAL RAVAL
 
C tokens.pptx
C tokens.pptxC tokens.pptx
C tokens.pptx
NavyaParashir
 
C PROGRAMMING LANGUAGE.pptx
 C PROGRAMMING LANGUAGE.pptx C PROGRAMMING LANGUAGE.pptx
C PROGRAMMING LANGUAGE.pptx
AnshSrivastava48
 
programming week 2.ppt
programming week 2.pptprogramming week 2.ppt
programming week 2.ppt
FatimaZafar68
 
Introduction
IntroductionIntroduction
Introduction
Komal Pardeshi
 
Programming in c
Programming in cProgramming in c
Programming in c
vineet4523
 
C presentation book
C presentation bookC presentation book
C presentation book
krunal1210
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
Muthuselvam RS
 
Chap 1 and 2
Chap 1 and 2Chap 1 and 2

Similar to Constants variables data_types (20)

Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introduction
 
Constants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya JyothiConstants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya Jyothi
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
 
All C ppt.ppt
All C ppt.pptAll C ppt.ppt
All C ppt.ppt
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_output
 
CONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN CCONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN C
 
Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++Keywords, identifiers ,datatypes in C++
Keywords, identifiers ,datatypes in C++
 
Data types slides by Faixan
Data types slides by FaixanData types slides by Faixan
Data types slides by Faixan
 
COM1407: Variables and Data Types
COM1407: Variables and Data Types COM1407: Variables and Data Types
COM1407: Variables and Data Types
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
PSPC--UNIT-2.pdf
PSPC--UNIT-2.pdfPSPC--UNIT-2.pdf
PSPC--UNIT-2.pdf
 
FUNDAMENTAL OF C
FUNDAMENTAL OF CFUNDAMENTAL OF C
FUNDAMENTAL OF C
 
C tokens.pptx
C tokens.pptxC tokens.pptx
C tokens.pptx
 
C PROGRAMMING LANGUAGE.pptx
 C PROGRAMMING LANGUAGE.pptx C PROGRAMMING LANGUAGE.pptx
C PROGRAMMING LANGUAGE.pptx
 
programming week 2.ppt
programming week 2.pptprogramming week 2.ppt
programming week 2.ppt
 
Introduction
IntroductionIntroduction
Introduction
 
Programming in c
Programming in cProgramming in c
Programming in c
 
C presentation book
C presentation bookC presentation book
C presentation book
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
Chap 1 and 2
Chap 1 and 2Chap 1 and 2
Chap 1 and 2
 

Recently uploaded

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 

Recently uploaded (20)

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 

Constants variables data_types

  • 1. Fundamentals of C C TOKENS • Tokens are the smallest individual units of a c program. There are six types of tokens in c language as shown in following figure :-
  • 2. Fundamentals of C KEYWORDS AND IDENTIFIERS • Every C word is defined as either keyword or an identifier. • A keyword is a word or phrase which has fixed meaning and its meaning cannot be changed. • Keywords serve as basic building blocks for program statement. The list of C keywords are listed in below Table :- Table – C Keywords
  • 3. Fundamentals of C KEYWORDS AND IDENTIFIERS • Identifiers refers to the name of variables, functions and arrays. • These are user-defined names and consist of a sequence of letters and digits, with a letter as a first character. • Both uppercase and lowercase letters are permitted; lowercase letters are used very frequently. • Underscore character is used as identifier also and it used as link to connect two words in long identifiers. • There are following rules to define an identifier :- 1. First character must be an alphabet ( or underscore ). 2. An identifier must consist of only letters, digits or underscore. 3. Only first 31 characters are considered significant. 4. An identifier must not contain white space.
  • 4. Fundamentals of C CONSTANTS • Constants in C language refers to fixed values that do not change during the execution of a program. • C language has several types of constants as shown in following figure :- CONSTANTS NUMERIC CONSTANTS CHARACTER CONSTANTS INTEGER CONSTANTS REAL CONSTANTS SINGLE CHARACTER CONSTANTS STRING CONSTANTS Fig : Basic Types of C constants
  • 5. Fundamentals of C CONSTANTS • Integer Constants - 1. Integer constants refer to a sequence of digits. 2. There are following three types of integers :- I. Decimal Integers - • Decimal integer consists of a set of digits , 0 through 9, preceded by an optional – or + sign. • Examples :- 123 -321 0 654321 +78 • Embedded spaces, commas, and non-digit characters are not permitted between digits . For example, 18 750 20,000 $1000 are illegal numbers. II. Octal Integers – • An octal integer constant consists of any combination of digits from the set 0 through 7, with a leading 0. Some examples of octal integer are : 037 0 0435 0551 III. Hexadecimal Integers – • A sequence of digits preceded by 0x or 0X is considered as hexadecimal integers. • They may also include alphabets A through F or a through f , the letter A through F represent the numbers 10 through 15. • Examples :– 0X2 0x9F 0Xbcd 0x
  • 6. Fundamentals of C CONSTANTS • Real Constants – 1. Integer numbers are not sufficient to represent quantities that vary continuously, such as distances, heights, temperatures, prices, and so on. 2. These quantities are represented by numbers containing fractional parts like 17.584. 3. Such numbers are called real ( or floating point ) constants. 4. Examples :- 0.0083 -0.75 435.36 +84.0 0.65e4 12E-2 5. Real Constants can be expressed in following two types of notations :- I. Decimal Notation :- 215.15 210. -.71 +.5 +85.0 -112.5 II. Exponential ( Scientific ) Notation :- • mantissa e exponent • 0.5e4 18e-2 1.5e+5 3.18E3 -1.2E-1 • This notation is useful to represent which are very large or small in magnitude. For example, 85000000000 can be written as 8.5E10 or 85E9 • Similarly 0.000000036 is equivalent to -3.6E8 6. These constants are normally represented as double-precision quantities . Suffix f or F is used to force single digit precision and l or L is used to force double digit precision further.
  • 7. Fundamentals of C CONSTANTS • Single Character Constants – 1. A single character constant (or simply character constant) contains a single character enclosed within a pair of single quote marks. 2. Example:- ‘5’ ‘a’ ‘A’ ‘;’ ‘ ‘ • String Constants – 1. A string constant is a sequence of characters enclosed in double quotes. The characters may be letters, numbers, special characters and blank space. 2. Example :- “Hello!” “2020” “GOOD MORNING” “?.......!” “5+3” “X”
  • 8. Fundamentals of C VARIABLES • A variable is nothing but a name given to a storage area that our programs can manipulate. • Unlike constants that remain unchanged during execution of program, a variable may take different values at different times during execution of program. • Each variable in C has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable. • A variable name may consist of letters, digits, and the underscore(_)character, subject to the following conditions :- 1. They must begin with a letter. Some systems permits underscore as the first character. 2. Standard length for a variable name is 31 characters. However length should not be more than eight characters, since only first 8 characters are treated as significant by many compilers. 3. Uppercase and lowercase are significant i.e. the variable Total is not same as total or TOTAL. 4. It should not be a keyword. 5. White space is also not allowed • A variable name can be chosen by the programmer in a meaningful way so as to reflect its function or nature in the program. Example :- Average, height, Total, Counter_1, class_strength, distance, ph_value, mark. • Some Invalid examples of variables are 123 (area) % 25th
  • 9. Fundamentals of C DATA TYPES • Data types refers to an extensive system used for declaring variables or functions of different types. • Data types specify how we enter data into our programs and what type of data we enter. • The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted. This determines the type and size of data associated with variables. • Each data type requires different amounts of memory and has some specific operations which can be performed over it. • There are three classes(types) of data types : 1. Primary (or fundamental) data types 2. Derived data types 3. User-defined data types
  • 10. Fundamentals of C DATA TYPES 1. Primary (or fundamental) data types – • Every C compiler supports following types of primary data types : Fig : Primary data types in C l
  • 11. Fundamentals of C DATA TYPES 1. Primary (or fundamental) data types – I. Integer Types – • Integers are whole numbers with a range value supported by a particular machine. • Integers are defined in C by the keyword int. • Generally integers occupy one word of storage, and since the word sizes of machines vary (typically 16 ,32 or 64 bits) the size of an integer that can be stored depends on the computer. • If 16 bit word length is used , the size of the integer value is limited to the range -32768 to +32767(that is, −215 𝑡𝑜 +215 −1. • For 32 bit machine the range id -2,147,483,648 to 2,147,483,647. • A signed integer uses one bit for sign and 15 bits for the magnitude of the number . • C language has 3 classes of integer storage, namely short int, int, and long int, in both signed and unsigned forms. Unlike signed integers , unsigned integers use all the bits for magnitude of the number and are always positive. • We use long and unsigned integers to increase the range of values.
  • 12. Fundamentals of C DATA TYPES 1. Primary (or fundamental) data types – II. Floating Point Types – • Floating point numbers are stored in 32 bits ( on all 16 bits and 32 bits machines), with 6 digits precision. • Floating point numbers are defined in C by the keyword float. • When the accuracy provided by a float number is not sufficient, the type double can be used to define the number. • A double data type number uses 64 bits giving a precision of 14 digits. These are known as double precision numbers. • To extend the precision further, we may use long double which uses 80 bits. float double long double
  • 13. Fundamentals of C DATA TYPES 1. Primary (or fundamental) data types – III. Character Types – • A single character can be defined as a character(char) type data. • Characters are usually stored in 8 bits (one byte) of internal storage. • The qualifier signed or unsigned may be explicitly applied to char. • While unsigned chars have values between 0 and 255, signed chars have values from -128 to 127. IV. Void Types – • The void type has no values. • This is usually used to specify the type of functions. The type of a function is said to be void when it does not return any value to the calling function .
  • 14. Fundamentals of C DATA TYPES 1. Primary (or fundamental) data types – Table : Size and Range of Data Types on 16-bit machine
  • 15. Fundamentals of C DATA TYPES 2. Derived data types – • C supports three derived data types :-
  • 16. Fundamentals of C DATA TYPES 3. User-defined data types – • C supports the feature called type definition which allows the programmer to define their identifier that would represent an existing data types. There are three such data types: