C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 7, Problem 7.10E
a)
Program Plan Intro
To write a single code statement to define the variable lptr to be a pointer to an object of type long.
b)
Program Plan Intro
To write a single code statement toassign the address of value 1to lptr pointer variable.
c)
Program Plan Intro
To write a single code statement to print the value of object pointed by lptr .
d)
Program Plan Intro
To write a single code statement to assign the value of object pointed by the lptrto value 2 variable.
e)
Program Plan Intro
To write a single code statement to print the value of variable, value2.
f)
Program Plan Intro
To write a single code statement to print the address of variable, value1.
g)
Program Plan Intro
To write a single code statement to print the address stored in lptr and to state that the value of lptr is same as of value1 or not.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
In C Language
Declare an integer pointer variable intPointer. Initialize it to point to an int variablenamed someInt.Assign the value 451 to someInt and output (cout) the variable someInt and output (cout)the value pointed to by intPointer.Write an assignment statement that indirectly stores 900 into the value pointed to by intPointer.Output (cout) the value pointed to by intPointer and output (cout) the variable someInt,
In C language
Chapter 7 Solutions
C How to Program (8th Edition)
Ch. 7 - Answer each of the following: The _____ operator...Ch. 7 - Prob. 7.10ECh. 7 - Do each of the following: Write the function...Ch. 7 - (Simulation: The Tortoise and the Hare) In this...Ch. 7 - (Card Shuffling and Dealing Modification) Modify...Ch. 7 - What does this program do, assuming that the user...Ch. 7 - What does this program do?Ch. 7 - Find the error in each of the following program...Ch. 7 - (Maze Traversal) The following grid is a...Ch. 7 - Prob. 7.23E
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
- Please show the output of the code and please provide all the details/ comments for codearrow_forwardA pointer variable cannot be: A Passed to a function as argument. B B Changed within the funcction. C Returned by a function. D Assigned as an integer value. Darrow_forwardWhen should a pointer parameter p be a reference parameter? Group of answer choices When the function changes p, and you do NOT want the change to affect the actual pointer argument. When the function changes p, and you want the change to affect the actual pointer argument. When the pointer points to a large object. When the function changes *p, and you do NOT want the change to affect the the object that is pointed at. When the function changes *p, and you want the change to affect the the object that is pointed at.arrow_forward
- Using C++ Programming language: Given the following definitions: int num1=1, num2=2; int *ptr1=NULL, *ptr2=NULL; Write the following statements: Assign ptr1 to the address of num1. Assign ptr2 to the address of num2. Using pointer notation, write a statement that compares the values that the pointers "point" to to see which is larger. (There is more than one way to do this. You choose.)arrow_forwardin C For each of the following, write a single statement that performs the indicated task. Assume that long integer variables value1 and value2 have been defined and that value1 has been initialized to 200000. a) Define the variable lPtr to be a pointer to an object of type long. b) Assign the address of variable value1 to pointer variable lPtr. c) Print the value of the object pointed to by lPtr. d) Assign the value of the object pointed to by lPtr to variable value2. e) Print the value of value2. f) Print the address of value1. g) Print the address stored in lPtr. Is the value printed the same as the address of value1?arrow_forwardCreate a function that can accept a pointers and array with values of 1000, 2, 3, 17, 50. Your program will display the array values and its averagearrow_forward
- What is the difference between a pointer to a constant and a constant pointer?arrow_forwardWhich of the following statements a), b) or c) is false? O a. You interact with an object via a reference, which behind the scenes is that object's address (or location) in the computer's memory-sometimes called a "pointer" in other languages. O b. After the following assignment the variable x contains the value 7: X = 7 OC. After the assignment in part b), you might say that x "points to" (that is, "references") the object containing 7. O d. All of the above statements are true.arrow_forwardIf s1 and s2 are pointers of the same type, then s2=s1 is a valid statement.True or false?arrow_forward
- 16. NULL can be assigned to a void pointer. True O Falsearrow_forwardWhich operations are not possible with pointers?arrow_forwardC Program Functions using Pointers Create a function modify that accepts an integer and divides the integer by 2 if it is even. If the integer is odd, add one and divide it by 2. The function does not return anything. In the main function, write a program that asks for an integer input and call the modify function by passing in the reference of that variable as a parameter. An initial code is provided for you. Just fill in the blanks. Input 1. One line containing an integer input Output Enter a number: 5 Before: 5 After: 3arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning