SlideShare a Scribd company logo
1 of 12
Shroff S.R. Rotary Institute of Chemical Technology
Principle Supporter & Sponsor-United Phosphorous Ltd(UPL)/Shroff family
Managed By Ankleshwar Rotary Education Society
Approved by AICTE, New Delhi, Govt. of Gujarat & GTU Affiliated
 Definition :
Pointers are the variables that contain the address of another
variable within the memory.
 Need of Pointers :
1) It enhances the capability of the language to manipulate data.
2) Pointers reduce the length and complexity of the program.
3) It is used for creating data structures such as linked lists, trees,
graphs and so on.
4) It increases the execution speed.
 Basics of Pointers :
Every data item in the computer is stored in the memory in one or
more adjacent locations depending upon its type. The computer’s
memory is sequential collection of storage cells. Each cell is
known as byte and has a number called address associated with
it. The addresses are named in a serial manner, starting from
zero. A computer system having 64 k memory will have its last
address as 65,535.
……………………………………Memory Cell
Address 0 1 2 3 4 …………………………………….. 65535
Memory Organization
Example : int x = 5;
The compiler automatically assigns memory for this value. Since every
location in the memory has a unique address, we represent the x’s location in
the memory as below :
x variable
5 value
1002 address
The variable x is associated with the memory address 1002. Since
memory addresses are just numbers, they can also be assigned to any
variables that can be stored in the memory location, like other simple
variables. Such variables that contain the memory address are called
Pointers.
Representation of x=5 in the memory
Pointer Declaration :
 Syntax :
data_type *ptvar;
Name of the pointer variable.
Asterisk (*) indicates that this variable is a pointer.
Data type of the pointer’s object.
This statement tells the compiler that :
1) ptvar is a pointer.
2) ptvar needs memory location.
3) ptvar points to a variable of type data_type.
 Examples :
int *p; - declares that ‘p’ is a pointer that points to an integer
data type (int refers to the data type of the variable
being pointed to by p).
float *abc; - declares that ‘abc’ is a pointer that points to a floating
point variable.
char *status; - declares that ‘status’ is a pointer that points to a char
variable.
Array of Pointers :
Since pointers are the variables that store the address, thus, array of
pointers is the collection of addresses.
Syntax : data_type *array_name [size];
Example : int arr[] = {2,1,8,10};
int *ptr[] = {arr, arr+1, arr+2, arr+3};
The above example is represented in the memory as below :
arr[0] arr[1] arr[2] arr[3]
2 1 8 10arr
201 202 203 204
ptr[0] ptr[1] ptr[2] ptr[3]
201 202 203 204ptr
3011 3012 3013 3014
Functions and Pointers :
A function can take a pointer of any data type as argument and can return
a pointer of any data type.
 Pointers to Functions :
A pointer to function is defined as the address of the code executed
when the function is called.
Syntax :
return_type *pointer_name(argument list);
The * along with the pointer_name acts as the function name.
 Example :
float *maxp(float, float);
float *maxp(float *xp, float *yp)
{
return xp>=yp?xp:yp;
}
In the above example, maxp is a pointer to function accepting two
float values and returning a float value.
Types of declaration of pointers :
int* pi(void) : declares pi to be a function returning a pointer to integer
with no arguments.
int *pi(void) : declares pi to be a pointer returning an integer value with
no arguments.
Unions
Unions like structures are the user defined data type and
somewhat similar to structures as they also contain members of
different data types.
Only difference is that – all members in the Union share
the same storage area in the computer’s memory while, each
members in the Structure is assigned its own unique storage
area.
Since the members of the union share the same memory,
only one member can be active at a time. Thus, Unions are
useful as they efficiently use the computer’s memory.
 Declaring Unions
union union_name
{
data_type member1;
data_type member2;
…………………………
}var1, var2, …;
union book
{
char title[15];
char *author;
int pages;
float price;
} b1, b2, b3;
union book
{
char title[15];
char author[10];
int pages;
float price;
} b1, *bptr;
Or union book *bptr;
Syntax Example Example
 Accessing union members :
Example : printf(“%s”, b1.title); // union variable accessing union member.
printf(“%s”, bptr -> title); // union pointer variable accessing union
member.

More Related Content

What's hot

C programming session 11
C programming session 11C programming session 11
C programming session 11Dushmanta Nath
 
When to use a structure vs classes in c++
When to use a structure vs classes in c++When to use a structure vs classes in c++
When to use a structure vs classes in c++Naman Kumar
 
C programming session 08
C programming session 08C programming session 08
C programming session 08Dushmanta Nath
 
C programing -Structure
C programing -StructureC programing -Structure
C programing -Structureshaibal sharif
 
Computer programming(C++): Structures
Computer programming(C++): StructuresComputer programming(C++): Structures
Computer programming(C++): StructuresJishnuNath7
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Raj Naik
 
Introduction to Data Structure : Pointer
Introduction to Data Structure : PointerIntroduction to Data Structure : Pointer
Introduction to Data Structure : PointerS P Sajjan
 
Session 05 cleaning and exploring
Session 05 cleaning and exploringSession 05 cleaning and exploring
Session 05 cleaning and exploringbodaceacat
 
Presentation on c programing satcture
Presentation on c programing satcture Presentation on c programing satcture
Presentation on c programing satcture topu93
 
ML2014_Poster_ TextClusteringDemo
ML2014_Poster_ TextClusteringDemoML2014_Poster_ TextClusteringDemo
ML2014_Poster_ TextClusteringDemoGeorge Simov
 
Data structures using C
Data structures using CData structures using C
Data structures using CPdr Patnaik
 
An Introduction to the C++ Standard Library
An Introduction to the C++ Standard LibraryAn Introduction to the C++ Standard Library
An Introduction to the C++ Standard LibraryJoyjit Choudhury
 
Session 07 text data.pptx
Session 07 text data.pptxSession 07 text data.pptx
Session 07 text data.pptxbodaceacat
 
4 dynamic memory allocation
4 dynamic memory allocation4 dynamic memory allocation
4 dynamic memory allocationFrijo Francis
 

What's hot (20)

C programming session 11
C programming session 11C programming session 11
C programming session 11
 
When to use a structure vs classes in c++
When to use a structure vs classes in c++When to use a structure vs classes in c++
When to use a structure vs classes in c++
 
C programming session 08
C programming session 08C programming session 08
C programming session 08
 
C programing -Structure
C programing -StructureC programing -Structure
C programing -Structure
 
Computer programming(C++): Structures
Computer programming(C++): StructuresComputer programming(C++): Structures
Computer programming(C++): Structures
 
06 linked list
06 linked list06 linked list
06 linked list
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
 
Introduction to Data Structure : Pointer
Introduction to Data Structure : PointerIntroduction to Data Structure : Pointer
Introduction to Data Structure : Pointer
 
Java part 2
Java part  2Java part  2
Java part 2
 
R brownbag seminar 2.3
R brownbag seminar 2.3R brownbag seminar 2.3
R brownbag seminar 2.3
 
Session 05 cleaning and exploring
Session 05 cleaning and exploringSession 05 cleaning and exploring
Session 05 cleaning and exploring
 
Presentation on c programing satcture
Presentation on c programing satcture Presentation on c programing satcture
Presentation on c programing satcture
 
ML2014_Poster_ TextClusteringDemo
ML2014_Poster_ TextClusteringDemoML2014_Poster_ TextClusteringDemo
ML2014_Poster_ TextClusteringDemo
 
C1320prespost
C1320prespostC1320prespost
C1320prespost
 
Python libraries
Python librariesPython libraries
Python libraries
 
Data structures using C
Data structures using CData structures using C
Data structures using C
 
Data types in python
Data types in pythonData types in python
Data types in python
 
An Introduction to the C++ Standard Library
An Introduction to the C++ Standard LibraryAn Introduction to the C++ Standard Library
An Introduction to the C++ Standard Library
 
Session 07 text data.pptx
Session 07 text data.pptxSession 07 text data.pptx
Session 07 text data.pptx
 
4 dynamic memory allocation
4 dynamic memory allocation4 dynamic memory allocation
4 dynamic memory allocation
 

Similar to Computer programming and utilization (2)

Chapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfChapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfTamiratDejene1
 
358 33 powerpoint-slides_3-pointers_chapter-3
358 33 powerpoint-slides_3-pointers_chapter-3358 33 powerpoint-slides_3-pointers_chapter-3
358 33 powerpoint-slides_3-pointers_chapter-3sumitbardhan
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Typesk v
 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data typesManisha Keim
 
Mca ii dfs u-2 array records and pointer
Mca ii dfs u-2 array records and pointerMca ii dfs u-2 array records and pointer
Mca ii dfs u-2 array records and pointerRai University
 
C PROGRAMMING LANGUAGE
C  PROGRAMMING  LANGUAGEC  PROGRAMMING  LANGUAGE
C PROGRAMMING LANGUAGEPRASANYA K
 
c++ pointers by Amir Hamza Khan (SZABISTIAN)
c++ pointers by Amir Hamza Khan (SZABISTIAN)c++ pointers by Amir Hamza Khan (SZABISTIAN)
c++ pointers by Amir Hamza Khan (SZABISTIAN)Ameer Hamxa
 
220 runtime environments
220 runtime environments220 runtime environments
220 runtime environmentsJ'tong Atong
 
Bt0067 c programming and data structures2
Bt0067 c programming and data structures2Bt0067 c programming and data structures2
Bt0067 c programming and data structures2Techglyphs
 
Array and Pointers
Array and PointersArray and Pointers
Array and PointersProf Ansari
 
oop lecture 2
oop lecture 2oop lecture 2
oop lecture 2Atif Khan
 
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdfCOMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdfrajkumar2792005
 
Chp3(pointers ref)
Chp3(pointers ref)Chp3(pointers ref)
Chp3(pointers ref)Mohd Effandi
 
Tutorial on c language programming
Tutorial on c language programmingTutorial on c language programming
Tutorial on c language programmingSudheer Kiran
 

Similar to Computer programming and utilization (2) (20)

Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Chapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfChapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdf
 
358 33 powerpoint-slides_3-pointers_chapter-3
358 33 powerpoint-slides_3-pointers_chapter-3358 33 powerpoint-slides_3-pointers_chapter-3
358 33 powerpoint-slides_3-pointers_chapter-3
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data types
 
Mca ii dfs u-2 array records and pointer
Mca ii dfs u-2 array records and pointerMca ii dfs u-2 array records and pointer
Mca ii dfs u-2 array records and pointer
 
C PROGRAMMING LANGUAGE
C  PROGRAMMING  LANGUAGEC  PROGRAMMING  LANGUAGE
C PROGRAMMING LANGUAGE
 
c++ pointers by Amir Hamza Khan (SZABISTIAN)
c++ pointers by Amir Hamza Khan (SZABISTIAN)c++ pointers by Amir Hamza Khan (SZABISTIAN)
c++ pointers by Amir Hamza Khan (SZABISTIAN)
 
Data types
Data typesData types
Data types
 
220 runtime environments
220 runtime environments220 runtime environments
220 runtime environments
 
Bt0067 c programming and data structures2
Bt0067 c programming and data structures2Bt0067 c programming and data structures2
Bt0067 c programming and data structures2
 
Array and Pointers
Array and PointersArray and Pointers
Array and Pointers
 
oop lecture 2
oop lecture 2oop lecture 2
oop lecture 2
 
Pointers
PointersPointers
Pointers
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdfCOMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
 
Chapter16 pointer
Chapter16 pointerChapter16 pointer
Chapter16 pointer
 
Chp3(pointers ref)
Chp3(pointers ref)Chp3(pointers ref)
Chp3(pointers ref)
 
Tutorial on c language programming
Tutorial on c language programmingTutorial on c language programming
Tutorial on c language programming
 
Pointer
PointerPointer
Pointer
 

More from Digvijaysinh Gohil

Traits of a good listner (Communication Skills)
Traits of a good listner (Communication Skills)Traits of a good listner (Communication Skills)
Traits of a good listner (Communication Skills)Digvijaysinh Gohil
 
Techniques of reading (Communication Skills)
Techniques of reading (Communication Skills)Techniques of reading (Communication Skills)
Techniques of reading (Communication Skills)Digvijaysinh Gohil
 
Proxemics (Communication Skills)
Proxemics (Communication Skills)Proxemics (Communication Skills)
Proxemics (Communication Skills)Digvijaysinh Gohil
 
Proxemics (2) (Communication Skills)
Proxemics (2) (Communication Skills)Proxemics (2) (Communication Skills)
Proxemics (2) (Communication Skills)Digvijaysinh Gohil
 
Paralinguistic (Communication Skills)
Paralinguistic (Communication Skills)Paralinguistic (Communication Skills)
Paralinguistic (Communication Skills)Digvijaysinh Gohil
 
Paralinguistic (2) (Communication Skills)
Paralinguistic (2) (Communication Skills)Paralinguistic (2) (Communication Skills)
Paralinguistic (2) (Communication Skills)Digvijaysinh Gohil
 
Paralinguistic (1) (Communication Skills)
Paralinguistic (1) (Communication Skills)Paralinguistic (1) (Communication Skills)
Paralinguistic (1) (Communication Skills)Digvijaysinh Gohil
 
Organizing a contents & preparing an outline
Organizing a contents & preparing an outlineOrganizing a contents & preparing an outline
Organizing a contents & preparing an outlineDigvijaysinh Gohil
 
Organizing a contents & preparing an outline (2)
Organizing a contents & preparing an outline (2)Organizing a contents & preparing an outline (2)
Organizing a contents & preparing an outline (2)Digvijaysinh Gohil
 
Kinesics (Communication Skills)
Kinesics (Communication Skills)Kinesics (Communication Skills)
Kinesics (Communication Skills)Digvijaysinh Gohil
 
Kinesics (3) (Communication Skills)
Kinesics (3) (Communication Skills)Kinesics (3) (Communication Skills)
Kinesics (3) (Communication Skills)Digvijaysinh Gohil
 
Kinesics (2) (Communication Skills)
Kinesics (2) (Communication Skills)Kinesics (2) (Communication Skills)
Kinesics (2) (Communication Skills)Digvijaysinh Gohil
 
Introduction to communication (Communication Skills)
Introduction to communication (Communication Skills)Introduction to communication (Communication Skills)
Introduction to communication (Communication Skills)Digvijaysinh Gohil
 
Email etiquette (Communication Skills)
Email etiquette (Communication Skills)Email etiquette (Communication Skills)
Email etiquette (Communication Skills)Digvijaysinh Gohil
 
Welded joints (machine design & industrial drafting )
Welded joints (machine design & industrial drafting )Welded joints (machine design & industrial drafting )
Welded joints (machine design & industrial drafting )Digvijaysinh Gohil
 
Types of stresses and theories of failure (machine design & industrial drafti...
Types of stresses and theories of failure (machine design & industrial drafti...Types of stresses and theories of failure (machine design & industrial drafti...
Types of stresses and theories of failure (machine design & industrial drafti...Digvijaysinh Gohil
 
Treaded joint (machine design & industrial drafting )
Treaded joint (machine design & industrial drafting )Treaded joint (machine design & industrial drafting )
Treaded joint (machine design & industrial drafting )Digvijaysinh Gohil
 

More from Digvijaysinh Gohil (20)

Hydraulic cranes
Hydraulic cranesHydraulic cranes
Hydraulic cranes
 
Hydraulic braking systems
Hydraulic braking systemsHydraulic braking systems
Hydraulic braking systems
 
Human resources management
Human resources managementHuman resources management
Human resources management
 
Traits of a good listner (Communication Skills)
Traits of a good listner (Communication Skills)Traits of a good listner (Communication Skills)
Traits of a good listner (Communication Skills)
 
Techniques of reading (Communication Skills)
Techniques of reading (Communication Skills)Techniques of reading (Communication Skills)
Techniques of reading (Communication Skills)
 
Proxemics (Communication Skills)
Proxemics (Communication Skills)Proxemics (Communication Skills)
Proxemics (Communication Skills)
 
Proxemics (2) (Communication Skills)
Proxemics (2) (Communication Skills)Proxemics (2) (Communication Skills)
Proxemics (2) (Communication Skills)
 
Paralinguistic (Communication Skills)
Paralinguistic (Communication Skills)Paralinguistic (Communication Skills)
Paralinguistic (Communication Skills)
 
Paralinguistic (2) (Communication Skills)
Paralinguistic (2) (Communication Skills)Paralinguistic (2) (Communication Skills)
Paralinguistic (2) (Communication Skills)
 
Paralinguistic (1) (Communication Skills)
Paralinguistic (1) (Communication Skills)Paralinguistic (1) (Communication Skills)
Paralinguistic (1) (Communication Skills)
 
Organizing a contents & preparing an outline
Organizing a contents & preparing an outlineOrganizing a contents & preparing an outline
Organizing a contents & preparing an outline
 
Organizing a contents & preparing an outline (2)
Organizing a contents & preparing an outline (2)Organizing a contents & preparing an outline (2)
Organizing a contents & preparing an outline (2)
 
Kinesics (Communication Skills)
Kinesics (Communication Skills)Kinesics (Communication Skills)
Kinesics (Communication Skills)
 
Kinesics (3) (Communication Skills)
Kinesics (3) (Communication Skills)Kinesics (3) (Communication Skills)
Kinesics (3) (Communication Skills)
 
Kinesics (2) (Communication Skills)
Kinesics (2) (Communication Skills)Kinesics (2) (Communication Skills)
Kinesics (2) (Communication Skills)
 
Introduction to communication (Communication Skills)
Introduction to communication (Communication Skills)Introduction to communication (Communication Skills)
Introduction to communication (Communication Skills)
 
Email etiquette (Communication Skills)
Email etiquette (Communication Skills)Email etiquette (Communication Skills)
Email etiquette (Communication Skills)
 
Welded joints (machine design & industrial drafting )
Welded joints (machine design & industrial drafting )Welded joints (machine design & industrial drafting )
Welded joints (machine design & industrial drafting )
 
Types of stresses and theories of failure (machine design & industrial drafti...
Types of stresses and theories of failure (machine design & industrial drafti...Types of stresses and theories of failure (machine design & industrial drafti...
Types of stresses and theories of failure (machine design & industrial drafti...
 
Treaded joint (machine design & industrial drafting )
Treaded joint (machine design & industrial drafting )Treaded joint (machine design & industrial drafting )
Treaded joint (machine design & industrial drafting )
 

Recently uploaded

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 

Recently uploaded (20)

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 

Computer programming and utilization (2)

  • 1. Shroff S.R. Rotary Institute of Chemical Technology Principle Supporter & Sponsor-United Phosphorous Ltd(UPL)/Shroff family Managed By Ankleshwar Rotary Education Society Approved by AICTE, New Delhi, Govt. of Gujarat & GTU Affiliated
  • 2.
  • 3.  Definition : Pointers are the variables that contain the address of another variable within the memory.  Need of Pointers : 1) It enhances the capability of the language to manipulate data. 2) Pointers reduce the length and complexity of the program. 3) It is used for creating data structures such as linked lists, trees, graphs and so on. 4) It increases the execution speed.
  • 4.  Basics of Pointers : Every data item in the computer is stored in the memory in one or more adjacent locations depending upon its type. The computer’s memory is sequential collection of storage cells. Each cell is known as byte and has a number called address associated with it. The addresses are named in a serial manner, starting from zero. A computer system having 64 k memory will have its last address as 65,535. ……………………………………Memory Cell Address 0 1 2 3 4 …………………………………….. 65535 Memory Organization
  • 5. Example : int x = 5; The compiler automatically assigns memory for this value. Since every location in the memory has a unique address, we represent the x’s location in the memory as below : x variable 5 value 1002 address The variable x is associated with the memory address 1002. Since memory addresses are just numbers, they can also be assigned to any variables that can be stored in the memory location, like other simple variables. Such variables that contain the memory address are called Pointers. Representation of x=5 in the memory
  • 6. Pointer Declaration :  Syntax : data_type *ptvar; Name of the pointer variable. Asterisk (*) indicates that this variable is a pointer. Data type of the pointer’s object. This statement tells the compiler that : 1) ptvar is a pointer. 2) ptvar needs memory location. 3) ptvar points to a variable of type data_type.
  • 7.  Examples : int *p; - declares that ‘p’ is a pointer that points to an integer data type (int refers to the data type of the variable being pointed to by p). float *abc; - declares that ‘abc’ is a pointer that points to a floating point variable. char *status; - declares that ‘status’ is a pointer that points to a char variable.
  • 8. Array of Pointers : Since pointers are the variables that store the address, thus, array of pointers is the collection of addresses. Syntax : data_type *array_name [size]; Example : int arr[] = {2,1,8,10}; int *ptr[] = {arr, arr+1, arr+2, arr+3}; The above example is represented in the memory as below : arr[0] arr[1] arr[2] arr[3] 2 1 8 10arr 201 202 203 204 ptr[0] ptr[1] ptr[2] ptr[3] 201 202 203 204ptr 3011 3012 3013 3014
  • 9. Functions and Pointers : A function can take a pointer of any data type as argument and can return a pointer of any data type.  Pointers to Functions : A pointer to function is defined as the address of the code executed when the function is called. Syntax : return_type *pointer_name(argument list); The * along with the pointer_name acts as the function name.
  • 10.  Example : float *maxp(float, float); float *maxp(float *xp, float *yp) { return xp>=yp?xp:yp; } In the above example, maxp is a pointer to function accepting two float values and returning a float value. Types of declaration of pointers : int* pi(void) : declares pi to be a function returning a pointer to integer with no arguments. int *pi(void) : declares pi to be a pointer returning an integer value with no arguments.
  • 11. Unions Unions like structures are the user defined data type and somewhat similar to structures as they also contain members of different data types. Only difference is that – all members in the Union share the same storage area in the computer’s memory while, each members in the Structure is assigned its own unique storage area. Since the members of the union share the same memory, only one member can be active at a time. Thus, Unions are useful as they efficiently use the computer’s memory.
  • 12.  Declaring Unions union union_name { data_type member1; data_type member2; ………………………… }var1, var2, …; union book { char title[15]; char *author; int pages; float price; } b1, b2, b3; union book { char title[15]; char author[10]; int pages; float price; } b1, *bptr; Or union book *bptr; Syntax Example Example  Accessing union members : Example : printf(“%s”, b1.title); // union variable accessing union member. printf(“%s”, bptr -> title); // union pointer variable accessing union member.