Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 9.1, Problem 8STE
Program Plan Intro
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.
Explanation of Solution
Value returned by new operator:
The new operator returns a pointer to that memory, i.e., a pointer to that new dynamic variable, provid...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
what is & operator?
What does it mean when an operator is overloaded?
What exactly does the Assignment operator imply?
Chapter 9 Solutions
Problem Solving with C++ (9th Edition)
Ch. 9.1 - Prob. 1STECh. 9.1 - Prob. 2STECh. 9.1 - Give at least two uses of the operator. State...Ch. 9.1 - Prob. 4STECh. 9.1 - Prob. 5STECh. 9.1 - Suppose a dynamic variable were created as...Ch. 9.1 - Write a definition for a type called NumberPtr...Ch. 9.1 - Prob. 8STECh. 9.2 - Write a type definition for pointer variables that...Ch. 9.2 - Suppose your program contains code to create a...
Ch. 9.2 - Prob. 11STECh. 9.2 - Prob. 12STECh. 9.2 - What is the output of the following code fragment?...Ch. 9.2 - What is the output of the following code fragment?...Ch. 9.2 - What is the output of the following code fragment?...Ch. 9 - Prob. 1PCh. 9 - Write a program that asks the user to input an...Ch. 9 - Palindrome testing with pointers This Practice...Ch. 9 - Do Programming Project 3 in Chapter 7 in this...Ch. 9 - Do Programming Project 11 in Chapter 7 using a...Ch. 9 - Write a function that takes a C string as an input...Ch. 9 - Prob. 5PPCh. 9 - One problem with dynamic arrays is that once the...Ch. 9 - Prob. 7PPCh. 9 - Write a program that outputs a histogram of...
Knowledge Booster
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.Similar questions
- Explain overloading the post-increment operator.arrow_forwardThe friend function is incompatible with the goal of encapsulation. Also, talk about the many applications for the friend function that you have.arrow_forwardDescribe Confusion between the Equality Operator (==) and the Assignment Operator (=).arrow_forward
- What does it mean for an argument to be valid? Should we expect inductive arguments to be valid? Why or why not?arrow_forwardDevelop a substring operator using operator() in C++. The arguments should be the starting position for the substring and the length of the substring. The result should be a copy of the substring starting at the given position within our own data and ending at most the given length from the start. For example: Object's Value Operator Call Resulting Object's Value "bob wuz here" obj(0,4) "bob " "bob wuz here" obj(8,14) "here" (ran out of characters) "bob wuz here" obj(14,4) "" (nothing there) "bob wuz here" obj(4,1) "w" If the start position doesn't exist, send back an empty string (as we've defined). If there aren't 'length' characters left in our string after the given start position, return what we do have. Don't forget to write a test application to show that your operator works. (Perhaps you could modify the existing String test app?)arrow_forwardThe differences between value types and reference types applies to parameters. True Falsearrow_forward
- Why use increment and decrement operators? What are the advantages and disadvantages by providing examples in code?arrow_forwardFor this discussion, we are going to be working with operators. Below is the code for the Operators class, which contains a main() method and a divisible() method. Study the code below, paying special attention to the four if statements. First, explain using complete sentences how each if statement evaluates (true or false), as well as what takes place in each if statement's test (comparisons, function calls, increments/decrements, etc.). Then, provide what the program will output. public class Operators { public static void main(String[] args) { int a = 5, b = 10, c = 11; System.out.println("This program works with operators."); if (a < 10 ^ b == 10) System.out.println("Java "); if (divisible(b, a) | divisible(c, a)) System.out.println("Programming "); if (a + b - (++c) == c - (b--) + 1) System.out.println("CITC ");…arrow_forwardWhen a function can take another function as a parameter, how can type-checking occur?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning