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 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
The following describes the difference between void and NULL pointers: Make proper use of examples to bolster your argument.
The distinction between void and NULL pointers is as follows: Make use of appropriate examples to support your response.
Help and show me how to fix an error?
def kwargs_to_args_decorator(*args, **kwargs):
This question is meant to test your knowledge of creating a decorator that accepts an arbitrary number of positional and keyword arguments, to decorate a function that accepts an arbitrary number of positional and keyword arguments, and alters the arguments before passing them to the decorated function. When the decorated function is invoked, this decorator should modify the arguments the decorated function receives. This decorator should filter out all positional arguments passed to the decorated function, which are found in the positional arguments passed to the decorator when the decorator was initialized. It should also filter out all keyword arguments with keys that are found in the keyword arguments given to the decorator when the decorator was initialized. After performing the modifications to the arguments, the decorator should invoke the decorated function with the modified arguments and…
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
- C++ What is the error in the code below? my_struct_t *bar; /* ... do stuff, including setting bar to point to a defined my_struct_t object ... */ memset(bar, 0, sizeof(bar));arrow_forwardWhat benefits do enumeration types provide over a collection of named constants? What benefits does a subrange type have over its base type? When might a string be preferable over a character array?arrow_forwardDo void and NULL pointers differ? Support your answer with examples. Tabulate the differences.arrow_forward
- m6 lb Dont copy previous answers they are incorrect. Please provide a typed code and not pictures. The template was given below the code. we are just making changes to main cpp. We are writing one line of code based on the comments. C++ use shared pointers to objects, create vectors of shared pointers to objects and pass these as parameters. You need to write one line of code. Declare circleTwoPtr. Watch for **** in comments. Template code is given make changes and add stuff based on comments: Template given: main.cpp: #include<iostream>#include "Circle.h"#include <fstream>#include <vector>#include <memory>#include<cstdlib>#include <fstream>#include <sstream>using namespace std;const int SIZE = 10;// pay attention to this parameter listint inputData(vector<shared_ptr<Circle>> &circlePointerArray, string filename) { ifstream inputFile(filename); istringstream instream; string data; int count =0; int x,y,radius; try{ if…arrow_forwardWhat's Hiding Amongst the Crowd? Language - Java Script A word is on the loose and now has tried to hide amongst a crowd of tall letters! Help write a function to detect what the word is, knowing the following rules: The wanted word is in lowercase. The crowd of letters is all in uppercase. Note that the word will be spread out amongst the random letters, but their letters remain in the same order. ● Examples detectWord("UcUNFYGaFYFYGtNUH") → "cat" detectWord("bEEFGBuFBRrHgUHINFYaYr") → "burglar" detectWord("YFem HUFBbezFBYZF BYLleGBYEFGBMENTment") → "embezzlement"arrow_forwardvoid getChar(char& c, istream& infile, int& i){ infile.get(c); if (c == '\n') i++;} COULD YOU REWRITTE THE FUNCTION ABOVE. AND BY REWRITE. I MEAN CHANGE THE FUNCTION NAME, PARAMETERS, AND ITS IMPLEMENTATION. HOWEVER, THE FUNCTION MUST STILL ACHEIVE THE SAME GOAL.arrow_forward
- Revise the following Course class implementation in the following c++ code When adding a new student to the course, if the array capacity is exceeded, increase the array size by creating a new larger array and copying the contents of the current array to it. Implement the dropStudent function. Add a new function named clear() that removes all students from the course. Implement the destructor and copy constructor to perform a deep copy in the class. Write a test program that creates a course, adds three students, removes one, and displays the students in the course.arrow_forwardSelect the statement that is false regarding file guarding. Group of answer choices: In your .h files all code should be contained within the guards. It restricts the scope of a namespace, which prevents namespace pollution. If used properly it prevents redefinitions of classes/functions. It is an instruction to the preprocessor. It must make use of a unique identifier.arrow_forward• Download Labl17_q2.cpp from Canvas. Read the given code. The Arr class's purpose is to store and perform operations on an array. In C++, a basic array doesn't keep track of its own size. That's why when we pass an array to a function, we often pass an accompanying integer. • The Arr class we implement will hold the array as well as perform operations on the array such as "filling" the array with a stated value. • When we declare an array, we specify its datatype. We can have arrays of integers, arrays of strings, etc. Because we can have arrays of many distinct types, we will implement our Arr class as a class template. template The first template parameter T refers to the datatype of the array. The second parameter LENGTH refers to the array's maximum number of elements. Arrcint, 5> myIntArr; Arrestring, 4> myStrArr; • The first statement creates an int array called myIntarr with a capacity of 7 elements. When this templated class is created, T will be an int and LENGTH (always an…arrow_forward
- Please complete this program in C++ Please enusre that there is plenty of comments. PLENTY even if unessessary. Please include screenshots of actual code, screenshots of output, and code in the browser so I can copy and paste. Thank you.arrow_forwardThe following is the difference between void and NULL pointers: Use relevant examples to back up your statement.arrow_forwardAttach code and output screenshots and TRY to do it asap pleasearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning