SlideShare a Scribd company logo
1 of 10
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

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++ 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 1Ali Raza Jilani
 
C programming language
C programming languageC programming language
C programming languageAbin Rimal
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginnersophoeutsen2
 
programming week 2.ppt
programming week 2.pptprogramming week 2.ppt
programming week 2.pptFatimaZafar68
 
Fundamentals of Programming Constructs.pptx
Fundamentals of  Programming Constructs.pptxFundamentals of  Programming Constructs.pptx
Fundamentals of Programming Constructs.pptxvijayapraba1
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptxmadhurij54
 
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 Centrejatin batra
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxLikhil181
 
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
 
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).pdfKosmikTech1
 
INTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageINTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageGOKULKANNANMMECLECTC
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageRakesh Roshan
 

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#
 
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
 
INTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageINTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c language
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C language
 

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

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 

Recently uploaded (20)

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 

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