SlideShare a Scribd company logo
2
Most read
4
Most read
5
Most read
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

PPTX
FUNDAMENTAL OF C
PDF
Python Data Types
PPTX
C data type format specifier
PPTX
Tokens in C++
PPTX
Datatype in c++ unit 3 -topic 2
PDF
Introduction to c++
PDF
C++ Version 2
PPTX
Concept of c data types
FUNDAMENTAL OF C
Python Data Types
C data type format specifier
Tokens in C++
Datatype in c++ unit 3 -topic 2
Introduction to c++
C++ Version 2
Concept of c data types

What's hot (20)

PPTX
C++
 
PDF
C++ version 1
PPTX
Introduction to C++ Programming
PDF
2 expressions (ppt-2) in C++
PPTX
Variables in C++, data types in c++
PDF
PPT
Getting started with c++
PPTX
Variables and data types in C++
PPTX
Introduction To Programming with Python-1
PPTX
Programming construction tools
PPTX
Cpu-fundamental of C
PDF
Data handling CBSE PYTHON CLASS 11
PDF
C intro
PDF
Unit iii
PPTX
Programming Fundamentals
PPTX
Data Type in C Programming
PPT
constants, variables and datatypes in C
PPTX
Chapter 2.datatypes and operators
PDF
Pc module1
PPSX
Data type
C++
 
C++ version 1
Introduction to C++ Programming
2 expressions (ppt-2) in C++
Variables in C++, data types in c++
Getting started with c++
Variables and data types in C++
Introduction To Programming with Python-1
Programming construction tools
Cpu-fundamental of C
Data handling CBSE PYTHON CLASS 11
C intro
Unit iii
Programming Fundamentals
Data Type in C Programming
constants, variables and datatypes in C
Chapter 2.datatypes and operators
Pc module1
Data type
Ad

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

PPT
Unit 1 Built in Data types in C language.ppt
PPTX
datatypes-200723165518 (1).pptx
PPTX
Data-Types-in-C-Programming.Programming.pptxProgramming.pptxpptx
PPTX
C Programming : data types and types of variable.pptx
PDF
introduction to programming using ANSI C
PPTX
data types in C programming
PDF
cassignmentii-170424105623.pdf
PPTX
Data Types in C language
PPTX
Data types
PPTX
Memory management of datatypes
PPTX
Programming_in_C_language_Unit5.pptx course ATOT
PDF
C programming language
PPT
Structured Programming with C - Data Types.ppt
ODP
CProgrammingTutorial
PDF
Data structure & Algorithms - Programming in C
PPTX
Module 1:Introduction
PPTX
TAPASH kumar das its my college pptasjhk
PPTX
Basic C programming Language - Unit 1.pptx
PDF
Programming in C - interview questions.pdf
PPTX
data types in c programming language in detail
Unit 1 Built in Data types in C language.ppt
datatypes-200723165518 (1).pptx
Data-Types-in-C-Programming.Programming.pptxProgramming.pptxpptx
C Programming : data types and types of variable.pptx
introduction to programming using ANSI C
data types in C programming
cassignmentii-170424105623.pdf
Data Types in C language
Data types
Memory management of datatypes
Programming_in_C_language_Unit5.pptx course ATOT
C programming language
Structured Programming with C - Data Types.ppt
CProgrammingTutorial
Data structure & Algorithms - Programming in C
Module 1:Introduction
TAPASH kumar das its my college pptasjhk
Basic C programming Language - Unit 1.pptx
Programming in C - interview questions.pdf
data types in c programming language in detail
Ad

More from AnuragSrivastava272 (13)

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

Recently uploaded (20)

PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Cell Structure & Organelles in detailed.
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
master seminar digital applications in india
PDF
01-Introduction-to-Information-Management.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Basic Mud Logging Guide for educational purpose
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Insiders guide to clinical Medicine.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
Final Presentation General Medicine 03-08-2024.pptx
Sports Quiz easy sports quiz sports quiz
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Cell Structure & Organelles in detailed.
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPH.pptx obstetrics and gynecology in nursing
O7-L3 Supply Chain Operations - ICLT Program
human mycosis Human fungal infections are called human mycosis..pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
master seminar digital applications in india
01-Introduction-to-Information-Management.pdf
TR - Agricultural Crops Production NC III.pdf
Cell Types and Its function , kingdom of life
Renaissance Architecture: A Journey from Faith to Humanism
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Basic Mud Logging Guide for educational purpose
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Insiders guide to clinical Medicine.pdf
Computing-Curriculum for Schools in Ghana
102 student loan defaulters named and shamed – Is someone you know on the list?

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