This document discusses pointers in C++. It begins by defining a pointer as a variable that holds the memory address of another variable. It then lists three reasons why pointers are one of C++'s most useful features: 1) they allow direct access and manipulation of memory locations, 2) they support dynamic memory allocation, and 3) they can improve efficiency of certain routines. The document goes on to explain pointer declaration, initialization, arithmetic, and how to allocate and free dynamic memory using new and delete operators. It also discusses pointers and strings as well as constant pointers.
I prepared this slides for the student of FSC BSC BS Computer Science Students. These Slides are very easy to read and understand the pointer logic used in C++ Programming.
All Topic related to pointer is discussed and examples are given
I prepared this slides for the student of FSC BSC BS Computer Science Students. These Slides are very easy to read and understand the pointer logic used in C++ Programming.
All Topic related to pointer is discussed and examples are given
In computer science, a pointer is a programming language object, whose value refers to (or "points to") another value stored elsewhere in the computer memory using its memory address. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer.
An introduction to pointers and references in C++ (with elements of C++11 and C++14). The presentation introduces the readers to the concepts of pointers and references through the pragmatic need of writing a swap function between integers. Generic programming notions (e.g., type constructors) are adopted when useful for the explanation.
general use of pointer
what is pointer in c language
uses is pointer in c language
representation of pointer in c language
syantax of pointer in c language
program of pointer in c language
Maharashtra hsc board previous year papersHSC.co.in
All Subjects past papers of Maharashtra HSC board including of 2016. You will find previous year Board papers of 2016, 2015,2014,2013.
It also have Exam papers of Physics, Chemistry, Biology, English, Maths, Statistics, Accounts, Economics, Organisation of Commerce, Secretarial Practice, Hindi, Marathi , Urdu etc.
In computer science, a pointer is a programming language object, whose value refers to (or "points to") another value stored elsewhere in the computer memory using its memory address. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer.
An introduction to pointers and references in C++ (with elements of C++11 and C++14). The presentation introduces the readers to the concepts of pointers and references through the pragmatic need of writing a swap function between integers. Generic programming notions (e.g., type constructors) are adopted when useful for the explanation.
general use of pointer
what is pointer in c language
uses is pointer in c language
representation of pointer in c language
syantax of pointer in c language
program of pointer in c language
Maharashtra hsc board previous year papersHSC.co.in
All Subjects past papers of Maharashtra HSC board including of 2016. You will find previous year Board papers of 2016, 2015,2014,2013.
It also have Exam papers of Physics, Chemistry, Biology, English, Maths, Statistics, Accounts, Economics, Organisation of Commerce, Secretarial Practice, Hindi, Marathi , Urdu etc.
Describes the operation of optimized sorting algorithm bubblesort. The traditional bubblesort algorithm is also described. The time complexity is also described in detail. In the presentation, all content is provided with through examples.
At the end of this lecture students should be able to;
Define the C pointers and its usage in computer programming.
Describe pointer declaration and initialization.
Apply C pointers for expressions.
Experiment on pointer operations.
Identify NULL pointer concept.
Experiment on pointer to pointer, pointer arrays, arrays with pointers and functions with pointers.
Apply taught concepts for writing programs.
Dynamic Objects,Pointer to function,Array & Pointer,Character String ProcessingMeghaj Mallick
This is an PPT of C++ Programming Language. This includes the various topics such as "Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing ".
Pointers are among C’s most powerful, yet most difficult concepts to master. Some tasks like dynamic memory allocation done only by using pointers. So it is essential to learn pointers.
Pointers are a type of variable, just like int, double, etc., except instead of storing a value, they store a memory address of another variable.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
4. What is Pointer?
Pointer is a variable that holds a
memory address, usually location of
another variable.
The Pointers are one of the C++’s most
useful and powerful features.
5. How Pointers are one of the C++’s
most useful and powerful
features?
First : Pointer provide the means
through which the memory location of
variable can be directly accessed and
hence it can be manipulated in the way
as required.
6. Second: Pointer supports C++ dynamic
allocation routines.
Third: Pointer can improve the
efficiency of certain routines.
How Pointers are one of the C++’s
most useful and powerful
features?
7. C++ MEMORY MAP
STACK
HEAP
GLOBAL
VARIABLES
PROGRAM
CODE
STACK - This area is used for
function calls return address,
argument and local variables
HEAP – This area is used for
Dynamic Memory Allocation
GLOBAL VARIABLES - This
area is used to store global
variables where they exists as long
as the program continues
8. DYNAMIC AND STATIC
MEMORY ALLOCATION
The Golden Rule of computer states that
anything or everything that needs to be
processed must be loaded into internal
memory before its processing takes place.
Therefore the main memory is allocated in two
ways,
STATIC MEMORY ALLOCATION
DYNAMIC MEMORY ALLOCATION
9. STATIC MEMORY
ALLOCATION
In this technique the demanded memory is
allocated in advance that is at the compilation
time is called static memory allocation.
For example,
int s;
The compiler allocates the 2 bytes of memory
before its execution.
10. DYNAMIC MEMORY
ALLOCATION
In this technique the memory is allocated as
and when required during run time (program
execution) is called Dynamic memory
allocation.
C++ offers two types of operators called new
and delete to allocate and de-allocate the
memory at runtime.
11. FREE STORE
FREE STORE is a pool of unallocated heap
memory given to a program that is used by the
program for dynamic allocation during
execution.
12. DECLARATION AND
INITIALIZATION OF POINTERS
Pointer variables are declared like normal
variables except for the addition of unary
operator * (character)
The General Format of Pointer variable
declaration is ,
type * var_name;
where ,
type refers to any C++ valid data type and
var_name is any valid C++ variable
13. DECLARATION AND
INITIALIZATION OF POINTERS
For example,
int *iptr; // integer pointer variable points
to //another integer variable’s location.
float *fptr; // float type pointer variable points
to //another float type variable’s location.
char *cptr; // character type pointer variable
//points to another char type variable’s location.
14. Two Special Operators
Two special operators are used * and & are
with pointers.
& operator is called as address of operator
which provides the address of operand.
* Operator is called as at address and also
called as differencing which provides the
value being pointed by pointer.
16. NULL Pointer (ZERO POINTER)
A pointer variable must not remain uninitilized
since uninitialized pointer cause system crash.
Even if you do not have legal pointer value to
initialize a pointer, you can initialize it with
NULL pointer (ZERO POINTER).
int *iptr=NULL;
Note: In C++ version 11 nullptr keyword is
introduced to assign null. nullptr is legal empty
null pointer.
17. POINTER AIRTHMETIC
Only two arithmetic operators, addition and
subtraction may be performed on pointers.
When you add 1 to a pointer, you are actually
adding the size of what ever the pointer
pointing at.
For example,
iptr++;
iptr--;
18. POINTER AIRTHMETIC
Only two arithmetic operators, addition and
subtraction may be performed on pointers.
When you add 1 to a pointer, you are actually
adding the size of what ever the pointer pointing
at.
For example,
iptr++;
iptr--;
Note: In pointer arithmetic all pointers increase
and decrease by the length of the data type they
point to.
19. DYNAMIC ALLOCATION
OPERATORS - new OPERATOR
C++ offers two types of operators called new and
delete to allocate and de-allocate the memory at
runtime. Since these two operators operate upon free
store memory, they are also called as free store
operators
Syntax :
pointer_variable = new data type;
where pointer_variable pointer variable and datatype
is valid C++ datatype and new is operator which
allocates the memory (size of data type) at run time.
20. For example,
int *iptr=new int;
char *cptr=new char;
float *fptr=new float;
Once a pointer points to newly allocated memory,
data values can be stored there using at address
operator
*cptr=‘a’;
*fptr=1.34;
*iptr=89;
DYNAMIC ALLOCATION
OPERATORS - new OPERATOR
21. Initializing values at the time of declaration one can
rewrite like,
int *iptr=new int(89);
char *cptr=new char(‘a’);
float *fptr=new float(1.34);
DYNAMIC ALLOCATION
OPERATORS - new OPERATOR
22. DYNAMIC ALLOCATION
OPERATORS
CREATING DYNMIC ARRAYS 1D ARRAYS:
Syntax :
pointer_variable = new data type[size];
int *value=new int[10];
It will create memory space from the free store to
store 10 integers. Initilization while declaring dynamic
array is not possible but it is included in C++ compiler
ver 11.
23. CREATING DYNMIC ARRAYS (2D ARRAYS):
One needs to be tricky while defining 2D array as,
int *val,r,c,i,j;
cout<<“Enter dimensions”;
cin>>r>>c;
val=new int [ r * c ] ;
To read the elements of the 2D array
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
cin>> val [ i *c + j ] ;
}
DYNAMIC ALLOCATION
OPERATORS - new OPERATOR
24. The life time of the variable or object created by new is not
restricted to the scope in which it is created. It lives in the
memory until explicitly deleted using the delete operator.
Syntax:
delete pointer_variable;
For example, delete iptr;
FOR ARRAYS :
Syntax :
delete [ ] arraypointer_variable;
delete [ ] val;
DYNAMIC ALLOCATION
OPERATORS - delete OPERATOR
25. Improper use of new and delete may lead to memory
leaks. Make sure that the memory allocated through new
must be deleted through delete.
Otherwise this may lead to adverse effect on the
system
DYNAMIC ALLOCATION
OPERATORS – MEMORY LEAK
26. It is faster to use an element pointer than an index when
scanning arrays,
For 1D Array,
S[0]= *( S + 0 ) or *S or *(S)
S[1] = *( S + 1 )
S[2] = *( S + 2 )
FOR 2D Arrays,
S [ 0 ] [ 0 ] = *( S [ 0 ] + 0 ) or * ( * ( S + 0 ) )
S [ 0 ] [ 1 ] = *( S [ 0 ] + 1 ) or * ( * ( S + 1 ) )
S [ 1 ] [ 2 ] = *( S [ 1 ] + 2 ) or * ( * ( S + 1 ) +
2 )
ARRAYS
27. POINTERS AND STRINGS
A string is a one dimensional array of characters
terminated by a null ‘0’ . You have learnt in 11
std a string can be defined and processed as,
char name [ ] = “POINTER”;
for ( I = 0 ; name [ i ] ! = ‘ 0 ’ ; i + + )
cout<<name[i];
Alternatively the same can be achieved by
writing,
char name [ ] = “POINTER”;
char *cp;
for ( cp = name ; * cp ! = ‘ 0 ’ ; cp + + )
cout<< *cp ;
28. POINTERS AND STRINGS
Another Example,
char *names [ ] = { “Sachin”, “Kapil”, “Ajay”, “Sunil”, “Anil” };
char *t;
t=name[1] ; //pointing to string “Kapil”
cout<<*t; // will produce out put “Kapil”
Similarly
T=name[3]; will point to?
29. POINTERS AND CONST
Constant pointer mean that the pointer in consideration will
always point to the same address . Its address ( to which it is
pointing to ) can not be modified.
For example,
int n=44;
int *const ptr = &n;
++(*ptr); // allowed since it modifies the content.
++ptr; // illegal because pointer ptr is constant pointer