Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 9.1, Problem 1STE

Explanation of Solution

Pointer in C++:

A pointer is a variable whose value will be another variable’s address. Generally, a pointer variable is declared as follows:

type *var-name;

Here, type is the pointer’s base type and var-name is the pointer variable name. The asterisk is used to designate a variable as a pointer.

Example Program:

//Include libraries

#include <iostream>

//Use namespace

using namespace std;

//Define main method

int main()

{

// Declare variable

int  n = 10;

// Declare pointer variable

int  *in;

// Store address of var in pointer variable

in = &n;

//Print the value of the variable

cout << ...

Blurred answer
Students have asked these similar questions
In C++, what exactly is meant by the term "pointer variable"? What is the purpose of it?
In C++, how are pointers used with arrays, and what are the benefits to utilizing pointers?
What are pointers in C? How do you declare a pointer
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr