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.
Assignment-3
With the help of a C program show how to typecast a void * to an int * . Attach the code and output and
upload the file on classroom.
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));
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 variable int?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_forwardDo not use regular expressions in your solution for this exercise. Write a program that checks to see if an input password is valid or not. In this exercise, a valid password has the following characteristics: It contains at least eight characters. It contains at most 12 characters. It contains only alphabetic characters, digits and the underscore (‘_’) character. It does not start with a digit. It has a mix of upper-case and lower-case characters. Your class must contain the following method: public static String checkPassword(String input) This method receives a possible password as input and returns only the String“OK” if the password is valid. If the password is not valid then you can return the reason(s) for that as the return value. This is not a part of the requirements, however, and you don’t need to do that. You can simply return null for an invalid password.arrow_forward
- correct answer asaparrow_forward3: The code on the right is supposed to be the ARM code for procA; however, there are problems with the ARM code. C code: int procA(int x, int y) { int perimeter = (x + y) * 2; I return perimeter; } ARM code: I procA: add rø, r1, r2 mov r1, rø lsl #1 bx lr push {lr} Give the corrected version of the ARM code for procA:arrow_forwardAttach code and output screenshots and TRY to do it asap pleasearrow_forward
- Nonearrow_forwardint j; for (int i = 0; i < 5; i++) {j = 2*j*i;} What is j?arrow_forwardint fun(int k){ return ( ); void main(){ int n; cin >> n; n = n * fun(n); <-- 1 Fill in the appropriate statement and expression in fun, so that when it is called in main, and after the execution of the statement marked 1, the value of n would always be n3.arrow_forward
- 11.arrow_forward. State true or falseType conversion is automatic whereas type casting is explicit in C++A. TrueB. Falsearrow_forwardint p =5 , q =6; void foo ( int b , int c ) { b = 2 * c ; p = p + c ; c = 1 + p ; q = q * 2; print ( b + c ); } main () { foo (p , q ); print p , q ; } Explain and print the output of the above code when the parameters to the foo function are passed by value. Explain and print the output of the above code when the parameters to the foo function are passed by reference. Explain and print the output of the above code when the parameters to the foo function are passed by value result. Explain and print the output of the above code when the parameters to the foo function are passed by name.arrow_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