0% found this document useful (0 votes)
32 views69 pages

Unit1 - Introduction To CPPM

The document discusses the concepts of programming language, source code, object code and executable code. It defines that a programming language is a language used to communicate with computers. It also explains the types of programming languages and the differences between source code, object code and executable code.

Uploaded by

adobephoto0011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views69 pages

Unit1 - Introduction To CPPM

The document discusses the concepts of programming language, source code, object code and executable code. It defines that a programming language is a language used to communicate with computers. It also explains the types of programming languages and the differences between source code, object code and executable code.

Uploaded by

adobephoto0011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Introduction

Unit 1

– By Tushar Sir
– By Tushar Sir
Concept of Programming Language
● Language is a mode of communication that is used to share ideas, opinions with each
other. For example, if we want to teach someone, we need a language that is
understandable by both communicators.
● A programming language is an artificial language that can be used to control the
behavior of a machine, particularly a computer. Programming languages, like human
languages, are defined through the use of syntactic and semantic rules, to determine
structure and meaning respectively.
● Programming languages are used to facilitate communication about the task of
organizing and manipulating information, and to express algorithms precisely.
● A programming language is a computer language that is used by programmers
(developers) to communicate with computers. It is a set of instructions written in any
specific language ( C, C++, Java, Python) to perform a specific task.

– By Tushar Sir
Types of Programming Language

– By Tushar Sir
Types of Programming Language
1. Low-level programming language
Low-level language is machine-dependent (0s and 1s) programming language. The
processor runs low- level programs directly without the need of a compiler or interpreter,
so the programs written in low-level language can be run very fast.
Low-level language is further divided into two parts -
i) Machine Language: - Machine language is a type of low-level programming language.
It is also called as machine code or object code. Machine language is easier to read
because it is normally displayed in binary or hexadecimal form (base 16) form. It does not
require a translator to convert the programs because computers directly understand the
machine language programs. The advantage of machine language is that it helps the
programmer to execute the programs faster than the high-level programming language.

– By Tushar Sir
Types of Programming Language
ii) Assembly Language: - Assembly language (ASM) is also a type of low-level
programming language that is designed for specific processors. It represents the set of
instructions in a symbolic and human-understandable form. It uses an assembler to convert
the assembly language to machine language. The advantage of assembly language is that it
requires less memory and less execution time to execute a program.
2. High-level programming language
High-level programming language (HLL) is designed for developing user-friendly
software programs and websites. This programming language requires a compiler or
interpreter to translate the program into machine language (execute the program). The
main advantage of a high-level language is that it is easy to read, write, and maintain.
High-level programming language includes Python, Java, JavaScript, PHP, C#, C++,
Objective C, Cobol, Perl, Pascal, LISP, FORTRAN, and Swift programming language.

– By Tushar Sir
Types of Programming Language
A high-level language is further divided into three parts -

i) Procedural Oriented programming language: - Procedural Oriented Programming


(POP) language is derived from structured programming and based upon the procedure
call concept. It divides a program into small procedures called routines or functions.
Procedural Oriented programming language is used by a software programmer to create a
program that can be accomplished by using a programming editor like IDE, Adobe
Dreamweaver, or Microsoft Visual Studio. The advantage of POP language is that it helps
programmers to easily track the program flow and code can be reused in different parts of
the program. Example: C, FORTRAN, Basic, Pascal, etc.

– By Tushar Sir
Types of Programming Language
ii) Object-Oriented Programming language: - Object-Oriented Programming (OOP)
language is based upon the objects. In this programming language, programs are divided
into small parts called objects. It is used to implement real-world entities like inheritance,
polymorphism, abstraction, etc in the program to makes the program reusable, efficient,
and easy-to-use. The main advantage of object-oriented programming is that OOP is faster
and easier to execute, maintain, modify, as well as debug. Example: C++, Java, Python,
C#, etc.
iii) Natural language: - Natural language is a part of human languages such as English,
Russian, German, and Japanese. It is used by machines to understand, manipulate, and
interpret human's language. It is used by developers to perform tasks such as translation,
automatic summarization, Named Entity Recognition (NER), relationship extraction, and
topic segmentation. The main advantage of natural language is that it helps users to ask
questions in any subject and directly respond within seconds.

– By Tushar Sir
Types of Programming Language
3. Middle-level programming language

Middle-level programming language lies between the low-level programming language


and high-level programming language. It is also known as the intermediate programming
language and pseudo-language. A middle-level programming language advantages are that
it supports the features of high-level programming, it is a user-friendly language, and
closely related to machine language and human language. Example: C, C++, language

– By Tushar Sir
Introduction of Source Code, Object Code and
Executable Code

– By Tushar Sir
Source Code
● Source code refers to high level code or assembly code which is generated by
human/programmer.
● Source code is easy to read and modify. It is written by programmer by using any
High Level Language or Intermediate language which is human-readable.
● Source code contains comments that programmer puts for better understanding.
● Source code is provided to language translator which converts it into machine
understandable code which is called machine code or object code.
● Computer can not understand direct source code, computer understands machine code
and executes it.
● It is considered as fundamental component of computer.
● In simple we can say source code is a set of instructions/commands and statements
which is written by a programmer by using a computer programming language like C,
C++, Java, Python, Assembly language etc.
● So statements written in any programming language is termed as source code.

– By Tushar Sir
Object Code
● Object code refers to low level code which is understandable by machine.
● Object code is generated from source code after going through compiler or other
translator. It is in executable machine code format.
● Object code contains a sequence of machine understandable instructions to which
Central Processing Unit understands and executes.
● Object file contains object code. It is considered as one more of machine code.
● Some object file examples are common object file format (COFF), COM files and
“.exe” files. It is the output of a compiler or other translator.
● We can understand source code but we can not understand object code as it is not in
plain text like source code rather it is in binary formats.

– By Tushar Sir
Some similarities between Source code & Object code

– By Tushar Sir
Some similarities between Source code & Object code
● Both are necessary for the software development process: Source code is used to
create software, and object code is the final product of the compilation process that is
executed by the computer.
● Both are created using programming languages: Source code is written in a high-level
programming language such as Java, C++, or Python, and object code is generated by
the compiler when it translates the source code into machine code.
● Both are necessary for debugging: Source code is used for debugging during the
development process, while object code can be used for debugging after the software
has been compiled.
● Both are necessary for software maintenance: Source code is used for making
changes or modifications to the software, and object code can be used for
troubleshooting and resolving issues that may arise during the software’s lifespan.
● Both can be protected by copyright law: Source code and object code can be
protected by copyright law to prevent unauthorized copying or use.

– By Tushar Sir
Key differences between source code & object code
● Readability: Source code is human-readable, while object code is not.
● Editability: Source code can be easily edited and modified, while object code cannot.
● Portability: Source code can be compiled for different platforms, while object code
is specific to a particular platform or architecture.
● Size: Source code is generally larger than object code, as it includes comments, white
spaces, and other information that is not needed for execution.
● Debugging: Debugging is easier with source code, as programmers can see the code
and understand what is happening. Debugging object code requires specialized tools.
● Security: Source code is more vulnerable to unauthorized access and theft, as it is in
a human-readable format. Object code is more secure, as it is in a binary format that
cannot be easily understood.

– By Tushar Sir
Executable Code
● Executable code generally refers to machine language, which is the set of native
instructions the computer carries out in hardware.
● Executable files in the DOS/Windows world use .EXE and .COM file extensions,
while executable files in Mac, Linux and Unix do not require specific extensions.
● They are identified by their file structure.
● Executable code may also refer to programs written in interpreted languages that
require additional software to actually execute.
● Some interpreted languages remain in their source code form, such as JavaScript and
VBScript, while others are compiled into an intermediate language, such as Java and
Visual Basic.
● Interpreted languages require software "runtime engines" to convert the program into
executable instructions for a particular CPU family that the hardware executes.

– By Tushar Sir
Algorithm & Flowchart
● The word Algorithm means “a process or set of rules to be followed in calculations or
other problem-solving operations”.
● Therefore Algorithm refers to a set of rules/instructions that step-by-step define how a
work is to be executed in order to get the expected results.

– By Tushar Sir
Algorithm & Flowchart
● A flowchart is a graphical representation of an
algorithm.
● Programmers often use it as a
program-planning tool to solve a problem.
● It makes use of symbols that are connected
among them to indicate the flow of information
and processing.
● The process of drawing a flowchart for an
algorithm is known as “flowcharting”.

– By Tushar Sir
Algorithm & Flowchart
S. No Algorithm Flowchart

An algorithm is a step-by-step procedure to solve A flowchart is a diagram created with different shapes
1.
a problem. to show the flow of data.

2. The algorithm is complex to understand. A flowchart is easy to understand.

3. In the algorithm, plain text is used. In the flowchart, symbols/shapes are used.

4. The algorithm is easy to debug. A flowchart is hard to debug.

5. The algorithm is difficult to construct. A flowchart is simple to construct.


– By Tushar Sir
Algorithm & Flowchart
S. No Algorithm Flowchart

6. The algorithm does not follow any rules. The flowchart follows rules to be constructed.

The algorithm is the pseudo-code for the A flowchart is just a graphical representation of that
7.
program. logic.

– By Tushar Sir
Algorithm & Flowchart
● Common Abbreviations Used in P&ID
Terminal Box - Start / End

Input / Output

Process / Instruction

Decision

Connector / Arrow

– By Tushar Sir
Algorithm & Flowchart
Characteristics of an algorithm
In order to qualify as an algorithm, a sequence of instructions must process the following
characteristics:
1. Each and every instruction should be precise and unambiguous.
2. Each instruction should be executed in a finite time.
3. One or more instructions should not be repeated infinitely. This ensures that the
algorithm
will ultimately terminate.
4. After performing the instructions (when algorithm terminates), the desired results
are obtained

– By Tushar Sir
Algorithm & Flowchart
● The symbols above represent different parts of a flowchart.
● The process in a flowchart can be expressed through boxes and arrows with different
sizes and colors.
● In a flowchart, we can easily highlight certain elements and the relationships between
each part.
● An algorithm shows you every step of reaching the final solution, while a flowchart
shows you how to carry out the process by connecting each step.
● An algorithm uses mainly words to describe the steps while you can create a
flowchart with flowchart symbols to make the process more logical.

– By Tushar Sir
Algorithm & Flowchart
Example 1: Print 1 to 20

Algorithm:

● Step 1: Initialize X as 0,
● Step 2: Increment X by 1,
● Step 3: Print X,
● Step 4: If X is less than 20 then go back to step 2.

– By Tushar Sir
Algorithm & Flowchart

– By Tushar Sir
Algorithm & Flowchart
Example 2: Convert Temperature from Fahrenheit (℉) to Celsius (℃)

Algorithm:

● Step 1: Read temperature in Fahrenheit,


● Step 2: Calculate temperature with formula C=5/9*(F-32),
● Step 3: Print C.

– By Tushar Sir
Algorithm & Flowchart

– By Tushar Sir
Algorithm & Flowchart
Example 3: Determine Whether A Student Passed the Exam or Not

Algorithm:

● Step 1: Input grades of 4 courses M1, M2, M3 and M4,


● Step 2: Calculate the average grade with formula "Grade=(M1+M2+M3+M4)/4"
● Step 3: If the average grade is less than 60, print "FAIL", else print "PASS".

– By Tushar Sir
Algorithm & Flowchart

– By Tushar Sir
Concepts of Structured Programming Language
● The structured program consists of well structured and separated modules.
● But the entry and exit in a Structured program is a single-time event.
● It means that the program uses single-entry and single-exit elements.
● Therefore a structured program is well maintained, neat and clean program.
● This is the reason why the Structured Programming Approach is well accepted in the
programming world.

– By Tushar Sir
Advantages of Structured Programming Language
● Easier to read and understand
● User Friendly
● Easier to Maintain
● Mainly problem based instead of being machine based
● Development is easier as it requires less effort and time
● Easier to Debug
● Machine-Independent, mostly

– By Tushar Sir
Disadvantages of Structured Programming Language
● Since it is Machine-Independent, So it takes time to convert into machine code.
● The converted machine code is not the same as for assembly language.
● The program depends upon changeable factors like data-types. Therefore it needs to
be updated with the need on the go.
● Usually the development in this approach takes longer time as it is
language-dependent. Whereas in the case of assembly language, the development
takes lesser time as it is fixed for the machine.

– By Tushar Sir
Introduction to C
● C is a general-purpose programming language created by Dennis Ritchie at the Bell
Laboratories in 1972.
● It is a very popular language, despite being old.
● C is strongly associated with UNIX, as it was developed to write the UNIX operating
system.
● It is one of the most popular programming language in the world
● If you know C, you will have no problem learning other popular programming
languages such as Java, Python, C++, C#, etc, as the syntax is similar
● C is very fast, compared to other programming languages, like Java and Python
● C is very versatile; it can be used in both applications and technologies

– By Tushar Sir
Introduction of C program body structure
● Let's write our first program:

● By structure, it is meant that any program can be written in this structure only.
● Writing a C program in any other structure will hence lead to a Compilation Error.

– By Tushar Sir
Introduction of C program body structure
● The structure of a C program is as follows:

– By Tushar Sir
Components of C program
1. Header Files Inclusion – Line 1 [#include <stdio.h>]
● The first and foremost component is the inclusion of the Header files in a C program.
● A header file is a file with extension .h which contains C function declarations and
macro definitions to be shared between several source files.
● All lines that start with # are processed by a preprocessor which is a program invoked
by the compiler.
● In the above example, the preprocessor copies the preprocessed code of stdio.h to our
file.
● The .h files are called header files in C.

– By Tushar Sir
Components of C program
Some of the C Header files:

● stddef.h – Defines several useful types and macros.


● stdint.h – Defines exact width integer types.
● stdio.h – Defines core input and output functions
● stdlib.h – Defines numeric conversion functions, pseudo-random network generator,
and memory allocation
● string.h – Defines string handling functions
● math.h – Defines common mathematical functions.

– By Tushar Sir
Components of C program
2. Main Method Declaration – Line 2 [int main()]

● The next part of a C program is to declare the main() function.


● It is the entry point of a C program and the execution typically begins with the first
line of the main().
● The empty brackets indicate that the main doesn’t take any parameter.
● The int that was written before the main indicates the return type of main().
● The value returned by the main indicates the status of program termination.

– By Tushar Sir
Components of C program
3. Body of Main Method – Line 3 to Line 6 [enclosed in {}]
● The body of a function in the C program refers to statements that are a part of that
function.
● It can be anything like manipulations, searching, sorting, printing, etc.
● A pair of curly brackets define the body of a function.
● All functions must start and end with curly brackets.
4. Statement – Line 4 [printf(“Hello World”);]
● Statements are the instructions given to the compiler. In C, a statement is always
terminated by a semicolon (;).
● In this particular case, we use printf() function to instruct the compiler to display
“Hello World” text on the screen.

– By Tushar Sir
Components of C program
5. Return Statement – Line 5 [return 0;]

● The last part of any C function is the return statement.


● The return statement refers to the return values from a function.
● This return statement and return value depend upon the return type of the function.
● The return statement in our program returns the value from main().
● The returned value may be used by an operating system to know the termination
status of your program.
● The value 0 typically means successful termination.

– By Tushar Sir
Character set in C
The C language has a rich character set. It can be described under 3 main headings-

● Alphabets- These are alphabets of English language and can be in upper or lower
case. (E.g. A,B,C…..Z || a,b,c,…z)
● Digits- 0,1,2,…,9.
● Special Symbols- The C language also allows the use of special symbols such as →
(),[],{},~!@#%^&$*_-+=`\|;:’”,./?

– By Tushar Sir
Variables in C
● A variable is an entity which can hold a particular type of constant and this value can
change as per user’s wish. For e.g. x=10; here, x is a variable and 5 is a constant.
● Any variable can hold only a particular type of constant. The type of constant decides
the data type of the variable.
● A variable in simple terms is a storage place that has some memory allocated to it.
● It is used to store some form of data and retrieve it when required.
● Different types of variables require different amounts of memory and have some
specific set of operations that can be applied to them.

C Variable Declaration

– By Tushar Sir
Rules to define Variables in C
● Variable names may consist of letters, digits, and the underscore(_) character.
● They must begin with a letter. Some systems permit underscore as the first character.
● ANSI standard recognizes a length of 31 character. However, the length should not be
normally more than eight characters, since only the first eight characters are treated as
significant by many compilers.
● Uppercase and lowercase are significant. That is, the variable Total is not the same as
total or TOTAL.
● The variable name should not be a keyword.
● White space is not allowed.

– By Tushar Sir
Declaration of Variables in C
● Declaration of variables must be done before they are used in the program.
Declaration does two things.

1. It tells the compiler what the variable name is.

2. It specifies what type of data the variable will hold.

– By Tushar Sir
Constants in C
● The constants are those variables or values in the C which cannot be modified once
they are defined in the program.
● They have fixed values till the program’s life.
● We can only assign value to the constant in the declaration.
● There can be any type of constant like integer, float, octal, hexadecimal, character
constants, etc.
● The constants refer to fixed values that the program may not alter during its
execution.
● These fixed values are also called literals.
● The constants are treated just like regular variables except that their values cannot be
modified
● after their definition.

– By Tushar Sir
Types of Constants in C
1. Primary Constants →

a)Integer Constants, b)Real Constants, c)Character Constants.

2. Secondary Constants →

a)Array, b)Pointers, c)Structures, etc.

● There are two simple ways in C to define constants:

1. Using #define preprocessor.

2. Using const keyword.

– By Tushar Sir
Types of Constants in C
1. Using #define preprocessor.

Syntax : #define identifier value

2. The const Keyword

Syntax : const type variable = value;

– By Tushar Sir
Keywords in C
● To run a program and display the output, a programming language makes use of a
compiler.
● There are certain words that have a predefined meaning to a compiler.
● Thus the use of these words(keywords or reserved words) as a variable name is not
allowed, as it will lead to an ambiguous situation and resulting in an error.
● In C language there are 32 keywords. They are given below-

auto, break, case, char, const, continue, default, do, double, else, enum, extern, float,
for, goto, if, int, long, register, return, short, signed, sizeof, static, struct, switch,
typedef, union, unsigned, void, volatile, while.

– By Tushar Sir
Identifiers in C
● C identifiers represent the name in the C program, for example, variables, functions,
arrays, structures, unions, labels, etc.
● An identifier can be composed of letters such as uppercase, lowercase letters,
underscore, digits, but the starting letter should be either an alphabet or an
underscore.
● If the identifier is not used in the external linkage, then it is called as an internal
identifier.
● If the identifier is used in the external linkage, then it is called as an external
identifier.
● We can say that an identifier is a collection of alphanumeric characters that begins
either with an alphabetical character or an underscore, which are used to represent
various programming elements such as variables, functions, arrays, structures, unions,
labels, etc.

– By Tushar Sir
Identifiers in C
● There are 52 alphabetical characters (uppercase and lowercase), underscore character,
and ten numerical digits (0-9) that represent the identifiers. There is a total of 63
alphanumeric characters that represent the identifiers.
Rules for constructing C identifiers:
● The first character of an identifier should be either an alphabet or an underscore, and
then it can be followed by any of the character, digit, or underscore.
● It should not begin with any numerical digit.
● In identifiers, both uppercase and lowercase letters are distinct. Therefore, we can say
that identifiers are case sensitive.
● Commas or blank spaces cannot be specified within an identifier.
● Keywords cannot be represented as an identifier.
● The length of the identifiers should not be more than 31 characters.
● Identifiers should be written in such a way that it is meaningful, short, and easy to
read.
– By Tushar Sir
Literals in C
● Literals are the Constant values that are assigned to the constant variables.
● Literals represent fixed values that cannot be modified. Literals contain memory but
they do not have references as variables. Generally, both terms, constants, and literals
are used interchangeably.
● For example, “const int = 5;“, is a constant expression and the value 5 is referred to as
a constant integer literal.
● There are 4 types of literal in C and five types of literal in C++.
○ Integer literal
○ Float literal
○ Character literal
○ String literal

– By Tushar Sir
Literals in C

– By Tushar Sir
Data types in C
● As the name suggests, a Data Type defines the type of data being used.
● Whenever we define a variable or use any data in the C programming, we have to
specify the type of the data, so that the compiler knows what type of data to expect.
● Each data type requires different amounts of memory and has some specific
operations which can be performed over it.
● The data type is a collection of data with values having fixed values, meaning as well
as its characteristics.
● For example, you may want to use a number like 1, 2, 100, or a decimal points
number like 99.95, 10.5, or a text, like "Studytonight", all these values are handled
differently by the C compiler, hence, we use data types to define the type of data used
in any program.

– By Tushar Sir
Data types in C

– By Tushar Sir
Data types in C
● The data types in C can be classified as follows:

Types Description

Primitive data types are the most basic data types that are
Primitive Data Types used for representing simple values such as integers, float,
characters, etc.

The user-defined data types are defined by the user


User Defined Data Types
himself.

The data types that are derived from the primitive or


Derived Types
built-in datatypes are referred to as Derived Data Types.
– By Tushar Sir
Data types in C
Type Example
Basic character, integer, floating-point, double.
Derived Array, structure, union, etc.
Enumeration enums
Bool type true or false
void Empty value

– By Tushar Sir
Data types in C
Data Type Size (bytes) Range Format Specifier

short int 2 -32,768 to 32,767 %hd

unsigned short int 2 0 to 65,535 %hu

unsigned int 4 0 to 4,294,967,295 %u

-2,147,483,648 to
int 4 %d
2,147,483,647
– By Tushar Sir
Data types in C
-2,147,483,648 to
long int 4 %ld
2,147,483,647

unsigned long int 4 0 to 4,294,967,295 %lu

long long int 8 -(2^63) to (2^63)-1 %lld

unsigned long long 0 to


8 %llu
int 18,446,744,073,709,551,615

– By Tushar Sir
Data types in C
signed char 1 -128 to 127 %c

unsigned char 1 0 to 255 %c

float 4 %f
1.2E-38 to 3.4E+38

double 8 %lf
1.7E-308 to 1.7E+308

long double 16
3.4E-4932 to 1.1E+4932 %Lf
– By Tushar Sir
Primary Data Types in C Programming
Character Data Type

● Character data type allows its variable to store only a single character. The size of the
character is 1 byte. It is the most basic data type in C. It stores a single character and
requires a single byte of memory in almost all compilers.
● Range: (-128 to 127) or (0 to 255)
● Size: 1 byte
● Format Specifier: %c
● Syntax of char: char var_name;
● You can store alphabets from A-Z(and a-z) and 0-9 digits using char datatype. For
example

– By Tushar Sir
Primary Data Types in C Programming
Integer Data Type

● The integer datatype in C is used to store the whole numbers without decimal values.
Octal values, hexadecimal values, and decimal values can be stored in int data type.
● Range: -2,147,483,648 to 2,147,483,647
● Size: 4 bytes
● Format Specifier: %d
● Syntax of char: int var_name;
● The int data type is used to store non-fractional numbers which include positive,
negative, and zero values. The range of int is -2,147,483,648 to 2,147,483,647 and it
occupies 2 or 4 bytes of memory, depending on the system you’re using. For example,

– By Tushar Sir
Primary Data Types in C Programming
Integer Data Type

The integer data type can also be used as:

● unsigned int: Unsigned int data type in C is used to store the data values from zero to
positive numbers but it can’t store negative values like signed int.
● short int: It is lesser in size than the int by 2 bytes so can only store values from
–32,768 to 32,767.
● long int: Larger version of the int datatype so can store values greater than int.
● unsigned short int: Similar in relationship with short int as unsigned int with int.

– By Tushar Sir
Primary Data Types in C Programming
Float Data Type

● In C programming float data type is used to store floating-point values. Float in C is


used to store decimal and exponential values. It is used to store decimal numbers
(numbers with floating point values) with single precision.
● The keyword float is used to store decimal numbers.
● Range: 1.2E-38 to 3.4E+38
● Size: 4 bytes
● Format Specifier: %f
● Syntax of float: float var_name;
● It occupies 4 bytes of memory and ranges from 1e-37 to 1e+37. For example,

– By Tushar Sir
Primary Data Types in C Programming
Double Data Type

● A Double data type in C is used to store decimal numbers (numbers with floating
point values) with double precision.
● It is used to define numeric values which hold numbers with decimal values in C.
● The double data type is basically a precision sort of data type that is capable of
holding 64 bits of decimal numbers or floating points.
● Since double has more precision as compared to that float then it is much more
obvious that it occupies twice the memory occupied by the floating-point type.
● It can easily accommodate about 16 to 17 digits after or before a decimal point.
● The double datatype is used to store decimal numbers.

– By Tushar Sir
Primary Data Types in C Programming
Double Data Type

● Range: 1.7E-308 to 1.7E+308


● Size: 8 bytes
● Format Specifier: %lf
● Syntax of Double: double var_name;
● It occupies 8 bytes of memory and ranges from 1e-37 to 1e+37.
● The double datatype has more precision than float so double gives more accurate
results as compared to float.

– By Tushar Sir
Primary Data Types in C Programming
Void Data Type

● The void data type in C is used to specify that no value is present. It does not provide
a result value to its caller.
● It has no values and no operations. It is used to represent nothing.
● Void is used in multiple ways as function return type, function arguments as void, and
pointers to void.
● The void datatype is used when a function does not return any result.
● It occupies 0 bytes of memory.
● We use the void keyword for void data type.
● Here is how we use the void type with functions,

– By Tushar Sir
C Data type Modifiers:
● There are 4 datatype modifiers in C programming that are used along with the basic
data types to categorize them further.
● For example, if you say, there is a playground, it can be a park, a playground, or a
stadium, but if you say, there is a Cricket ground or a Football stadium, that would
make it even more precise.
● Similarly, there are modifiers in the C language, to make the primary data types more
specific.
● The following are the modifiers:
○ signed
○ unsigned
○ long
○ Short

– By Tushar Sir
C Data type Modifiers:
● signed and unsigned are used to represent the signed(+ and -) and unsigned(only +)
values for any data type.
● In simple words, the unsigned modifier means all positive values, while the signed
modifier means both positive and negative values.
● And long and short affects the range of the values for any datatype.
● For example, signed int, unsigned int, short int, long int, etc. are all valid data types in
the C language.

Note: The long, short, signed and unsigned are datatype modifier that can be used with
some primitive data types to change the size or length of the datatype.

– By Tushar Sir
Thank You

- By Tushar Sir

You might also like