Problem Solving With C++ (Looseleaf) - With Access
9th Edition
ISBN: 9780133835267
Author: SAVITCH
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 9.1, Problem 2STE
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.
Given code:
The given declaration is as follows.
int* intPtr1, intPtr2;
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Consider the following statement:int* p, q;This statement could lead to what type of misinterpretation?
What happens if you multiply ptr by four? Assuming ptr is a reference to an int, the following happens:
What is the difference between void and NULL pointers .Give suitable examples in support of your answer.Give the differences in TABULAR form.
Chapter 9 Solutions
Problem Solving With C++ (Looseleaf) - With Access
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
- When the code below is run, it produces undefined and unpredictable results. Why?Can you suggest an intervention to resolve this issue without removing or changingany of the existing lines of code? (hint: add a line of code) char *myPtr;myPtr = malloc(10*sizeof(char));for (int i = 0; i < 10; i++){myPtr[i] = 'a';}myPtr[10] = '\0';arrow_forwardC++ Explain your answer. True or False? After the following lines of code are executed, the pointer John is pointing to null. Person* John = new Person(); delete John;arrow_forwardWhat is the difference between void and null pointers.Give suitable example in support of your answerarrow_forward
- This is a debugging question I am struggling on - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Code - public class DebugCustomer { protected int idNumber; protected String name; protected double creditLimit; public DebugCustomer(int id, name, double creditLimit) { idNumber = id; name = name; creditLimit = credit; } public void display() { System.out.println("Customer # + idNumber + Name: " + name, "\nCredit limit $" + creditLimit); } } ----- public class DebugCustomerMakingPurchase extends DebugCustomer { private double amountOfPurchase; private boolean overLimit; public DebugCustomerMakingPurchase(int id, String name, double credit, double purchAmount) { amountOfPurchase = purchAmount;…arrow_forwardWhat does the following code? void xxxx(int arr[], int index[], int n){int temp[n]; for (int i=0; i<n; i++)temp[index[i]] = arr[i]; for (int i=0; i<n; i++){arr[i] = temp[i];index[i] = i;}}arrow_forwardWhat is the output of this code fragments? (given the declaration int a=1, b=2, c=3;):arrow_forward
arrow_back_ios
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