SlideShare a Scribd company logo
What are data types ?
int a=10;
Datatype
Variable Value or data
Semi-colon
What are data types ?
It decides which type of value variable will store
i.e. integer, float, character or decimal value.
There are 3 types of data type
• Primary or Primitive Datatype
• Derived or Non-Primitive Datatype
• User Defined Datatype
Primary or Primitive Datatype
Data types that have been given by the compiler or can be said as
inbuilt in it, called as primary data types or primitive data types.
• Integer type value
• Floating point type value
• Character type value
• Void type value
• Integer type value
Datatype Size(16 bit compiler) Range Format specifier
int or signed int 2 Byte -32767 to 32768 %d
unsigned int 2 Byte 0 to 65535 %u
short int 1 Byte -128 to 127 %hd
unsigned short int 1 Byte 0 to 255 %hu
long int or signed int 4 Byte -2,147,483,648 to 2,147,483,647 %ld
unsigned long int 4 Byte 0 to 4,294,967,295 %lu
• Floating point type value
Datatype Size(16 bit compiler) Range Format specifier
float 4 Bytes 1.2E-38 to 3.4E+38 %f
double 8 Bytes 2.3E-308 to 1.7E+308 %lf
long double 10 Bytes 3.4E-4932 to 1.1E+4932 %Lf
Precision
6 places
10 places
15 places
• Character type value and void type value
Datatype Size(16 bit compiler) Range Format specifier
char 1 Byte -127 to 128 %c
void means no value to is usually used with functions when function is not returning
any type of value it is set as void.
Example-: void addition ()
{
//code
}
What is Function ?
A block of code wrapped within a single name is called as functions, it is used
to do some specific task.
Types of function:-
1. Standard library functions
2. User defined functions
Standard library functions that have been already defined, in the C library within the header files,
that can directly be used like printf(), scanf().
Functions that is defined by the user, is called as user defined functions, it is a block of code that
is used to do some specific task.
User defined functions
A block of code wrapped within a single name is called as functions, it is used
to do some specific task.
Syntax:- return_type function_name(parameters)
{
//block of code
}
Let’s see an example of writing different kinds of function to add two
numbers.
void addition(int a,int b)
{
int sum =a+b;
printf(“%d”,sum);
}
int addition(int a,int b)
{
int sum =a+b;
return sum;
}
void addition()
{
int a=10, b=20;
int sum =a+b;
printf(“%d”,sum);
}
int addition(void)
{
int a=10, b=20;
int sum =a+b;
return sum;
}
No return type
with parameter
No return type
without
parameter
return type with
parameter
return type
without
parameter

More Related Content

What's hot

C++
C++C++
C++
k v
 
C++ version 1
C++  version 1C++  version 1
C++ version 1
JIGAR MAKHIJA
 
Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ Programming
Preeti Kashyap
 
2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++
Kuntal Bhowmick
 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++
Neeru Mittal
 
Unit v
Unit vUnit v
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
K Durga Prasad
 
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
 
Introduction To Programming with Python-1
Introduction To Programming with Python-1Introduction To Programming with Python-1
Introduction To Programming with Python-1
Syed Farjad Zia Zaidi
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction tools
sunilchute1
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of C
Suchit Patel
 
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
chinthala Vijaya Kumar
 
C intro
C introC intro
C intro
SHIKHA GAUTAM
 
Unit iii
Unit iiiUnit iii
Unit iii
SHIKHA GAUTAM
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
Hassan293
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
Qazi Shahzad Ali
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
Sahithi Naraparaju
 
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
Jasleen Kaur (Chandigarh University)
 
Pc module1
Pc module1Pc module1
Pc module1
SANTOSH RATH
 
Data type
Data typeData type
Data type
Frijo Francis
 

What's hot (20)

C++
C++C++
C++
 
C++ version 1
C++  version 1C++  version 1
C++ version 1
 
Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ Programming
 
2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++2 expressions (ppt-2) in C++
2 expressions (ppt-2) in C++
 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++
 
Unit v
Unit vUnit v
Unit v
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Variables and data types in C++
Variables and data types in C++Variables and data types in C++
Variables and data types in C++
 
Introduction To Programming with Python-1
Introduction To Programming with Python-1Introduction To Programming with Python-1
Introduction To Programming with Python-1
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction tools
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of C
 
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
 
C intro
C introC intro
C intro
 
Unit iii
Unit iiiUnit iii
Unit iii
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
 
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
 
Pc module1
Pc module1Pc module1
Pc module1
 
Data type
Data typeData type
Data type
 

Similar to What is Data Types and Functions?

Programming in C [Module One]
Programming in C [Module One]Programming in C [Module One]
Programming in C [Module One]
Abhishek Sinha
 
C material
C materialC material
C material
tarique472
 
C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1
Ali Raza Jilani
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
marvellous2
 
C programming language
C programming languageC programming language
C programming language
Abin Rimal
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginner
sophoeutsen2
 
C
CC
programming week 2.ppt
programming week 2.pptprogramming week 2.ppt
programming week 2.ppt
FatimaZafar68
 
Fundamentals of Programming Constructs.pptx
Fundamentals of  Programming Constructs.pptxFundamentals of  Programming Constructs.pptx
Fundamentals of Programming Constructs.pptx
vijayapraba1
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptx
madhurij54
 
Theory1&2
Theory1&2Theory1&2
C#
C#C#
Lesson 4 Basic Programming Constructs.pptx
Lesson 4 Basic Programming Constructs.pptxLesson 4 Basic Programming Constructs.pptx
Lesson 4 Basic Programming Constructs.pptx
John Burca
 
Structured Languages
Structured LanguagesStructured Languages
Structured Languages
Mufaddal Nullwala
 
C programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer CentreC programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer Centre
jatin batra
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
Likhil181
 
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
Rasan Samarasinghe
 
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
python-online&offline-training-in-kphb-hyderabad (1) (1).pdfpython-online&offline-training-in-kphb-hyderabad (1) (1).pdf
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
KosmikTech1
 
Introduction to C
Introduction to CIntroduction to C
Introduction to C
Janani Satheshkumar
 
BASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their ownBASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their own
Nandini485510
 

Similar to What is Data Types and Functions? (20)

Programming in C [Module One]
Programming in C [Module One]Programming in C [Module One]
Programming in C [Module One]
 
C material
C materialC material
C material
 
C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
C programming language
C programming languageC programming language
C programming language
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginner
 
C
CC
C
 
programming week 2.ppt
programming week 2.pptprogramming week 2.ppt
programming week 2.ppt
 
Fundamentals of Programming Constructs.pptx
Fundamentals of  Programming Constructs.pptxFundamentals of  Programming Constructs.pptx
Fundamentals of Programming Constructs.pptx
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptx
 
Theory1&2
Theory1&2Theory1&2
Theory1&2
 
C#
C#C#
C#
 
Lesson 4 Basic Programming Constructs.pptx
Lesson 4 Basic Programming Constructs.pptxLesson 4 Basic Programming Constructs.pptx
Lesson 4 Basic Programming Constructs.pptx
 
Structured Languages
Structured LanguagesStructured Languages
Structured Languages
 
C programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer CentreC programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer Centre
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
 
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
 
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
python-online&offline-training-in-kphb-hyderabad (1) (1).pdfpython-online&offline-training-in-kphb-hyderabad (1) (1).pdf
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
 
Introduction to C
Introduction to CIntroduction to C
Introduction to C
 
BASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their ownBASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their own
 

More from AnuragSrivastava272

What is recursion?
What is recursion? What is recursion?
What is recursion?
AnuragSrivastava272
 
What is Do while loop?
What is Do while loop? What is Do while loop?
What is Do while loop?
AnuragSrivastava272
 
What is while loop?
What is while loop?What is while loop?
What is while loop?
AnuragSrivastava272
 
What is loops? What is For loop?
What is loops? What is For loop?What is loops? What is For loop?
What is loops? What is For loop?
AnuragSrivastava272
 
What is Switch Case?
What is Switch Case?What is Switch Case?
What is Switch Case?
AnuragSrivastava272
 
What are conditional statements?
What are conditional statements?What are conditional statements?
What are conditional statements?
AnuragSrivastava272
 
What are operators?
What are operators? What are operators?
What are operators?
AnuragSrivastava272
 
What is Non-primitive data type?
What is Non-primitive data type?What is Non-primitive data type?
What is Non-primitive data type?
AnuragSrivastava272
 
What is Variables and Header files
What is Variables and Header filesWhat is Variables and Header files
What is Variables and Header files
AnuragSrivastava272
 
What is IDE?
What is IDE?What is IDE?
What is IDE?
AnuragSrivastava272
 
What is Platform Dependency?
What is Platform Dependency?What is Platform Dependency?
What is Platform Dependency?
AnuragSrivastava272
 
What is Computer Language?
What is Computer Language? What is Computer Language?
What is Computer Language?
AnuragSrivastava272
 
What is Language?
What is Language?What is Language?
What is Language?
AnuragSrivastava272
 

More from AnuragSrivastava272 (13)

What is recursion?
What is recursion? What is recursion?
What is recursion?
 
What is Do while loop?
What is Do while loop? What is Do while loop?
What is Do while loop?
 
What is while loop?
What is while loop?What is while loop?
What is while loop?
 
What is loops? What is For loop?
What is loops? What is For loop?What is loops? What is For loop?
What is loops? What is For loop?
 
What is Switch Case?
What is Switch Case?What is Switch Case?
What is Switch Case?
 
What are conditional statements?
What are conditional statements?What are conditional statements?
What are conditional statements?
 
What are operators?
What are operators? What are operators?
What are operators?
 
What is Non-primitive data type?
What is Non-primitive data type?What is Non-primitive data type?
What is Non-primitive data type?
 
What is Variables and Header files
What is Variables and Header filesWhat is Variables and Header files
What is Variables and Header files
 
What is IDE?
What is IDE?What is IDE?
What is IDE?
 
What is Platform Dependency?
What is Platform Dependency?What is Platform Dependency?
What is Platform Dependency?
 
What is Computer Language?
What is Computer Language? What is Computer Language?
What is Computer Language?
 
What is Language?
What is Language?What is Language?
What is Language?
 

Recently uploaded

South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
Kavitha Krishnan
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 

Recently uploaded (20)

South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 

What is Data Types and Functions?

  • 1. What are data types ? int a=10; Datatype Variable Value or data Semi-colon
  • 2. What are data types ? It decides which type of value variable will store i.e. integer, float, character or decimal value.
  • 3. There are 3 types of data type • Primary or Primitive Datatype • Derived or Non-Primitive Datatype • User Defined Datatype
  • 4. Primary or Primitive Datatype Data types that have been given by the compiler or can be said as inbuilt in it, called as primary data types or primitive data types. • Integer type value • Floating point type value • Character type value • Void type value
  • 5. • Integer type value Datatype Size(16 bit compiler) Range Format specifier int or signed int 2 Byte -32767 to 32768 %d unsigned int 2 Byte 0 to 65535 %u short int 1 Byte -128 to 127 %hd unsigned short int 1 Byte 0 to 255 %hu long int or signed int 4 Byte -2,147,483,648 to 2,147,483,647 %ld unsigned long int 4 Byte 0 to 4,294,967,295 %lu
  • 6. • Floating point type value Datatype Size(16 bit compiler) Range Format specifier float 4 Bytes 1.2E-38 to 3.4E+38 %f double 8 Bytes 2.3E-308 to 1.7E+308 %lf long double 10 Bytes 3.4E-4932 to 1.1E+4932 %Lf Precision 6 places 10 places 15 places
  • 7. • Character type value and void type value Datatype Size(16 bit compiler) Range Format specifier char 1 Byte -127 to 128 %c void means no value to is usually used with functions when function is not returning any type of value it is set as void. Example-: void addition () { //code }
  • 8. What is Function ? A block of code wrapped within a single name is called as functions, it is used to do some specific task. Types of function:- 1. Standard library functions 2. User defined functions Standard library functions that have been already defined, in the C library within the header files, that can directly be used like printf(), scanf(). Functions that is defined by the user, is called as user defined functions, it is a block of code that is used to do some specific task.
  • 9. User defined functions A block of code wrapped within a single name is called as functions, it is used to do some specific task. Syntax:- return_type function_name(parameters) { //block of code } Let’s see an example of writing different kinds of function to add two numbers.
  • 10. void addition(int a,int b) { int sum =a+b; printf(“%d”,sum); } int addition(int a,int b) { int sum =a+b; return sum; } void addition() { int a=10, b=20; int sum =a+b; printf(“%d”,sum); } int addition(void) { int a=10, b=20; int sum =a+b; return sum; } No return type with parameter No return type without parameter return type with parameter return type without parameter