Question

** Will Give Rating Immediately! ** When should a pointer parameter p be a reference parameter?...

** Will Give Rating Immediately! **

When should a pointer parameter p be a reference parameter?

Question 5 options:

A

When the function changes p, and you want the change to affect the actual pointer argument.

B

When the function changes p, and you do NOT want the change to affect the actual pointer argument.

C

When the function changes *p, and you want the change to affect the the object that is pointed at.

D

When the function changes *p, and you do NOT want the change to affect the the object that is pointed at.

E

When the pointer points to a large object.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

A

When the function changes p, and you want the change to affect the actual pointer argument.

With reference pointer, the pointer itself starts pointing to some other object.

Add a comment
Know the answer?
Add Answer to:
** Will Give Rating Immediately! ** When should a pointer parameter p be a reference parameter?...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p;...

    Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p; int i; int k; i = 42; k = i; p = &i; After these statements, which of the following statements will change the value of i to 75? A. k = 75; B. *k = 75; C. p = 75; D. *p = 75; E. Two or more of the answers will change i to 75. Consider the following statements: int i =...

  • COSC 112 Test #3 Spring 2019 20. It is not necessary to specify the parameter name...

    COSC 112 Test #3 Spring 2019 20. It is not necessary to specify the parameter name in the parameter list of a function prototype even 21. Which of following is not a situation when reference parameters are useful? though there is a default parameter. (True/False) a. When you don't want to have side effects b. When you need to change the actual parameter c. When you need to return more than one value d. When you want to save memory...

  • C++ Language 1. True/False: You can use pass by reference when passing a C++ unique pointer...

    C++ Language 1. True/False: You can use pass by reference when passing a C++ unique pointer to a function. a)True b)False 2. True/False: A temporary value in a program can be referred to by at most one lvalue reference. a)True b)False 3. A unique pointer is a pointer a that is declared in a block of code in which it is the only pointer. b that is declared in a function in which it is the only pointer. c that...

  • (15 pts) Using the following example, int a, p=&a; *p = 20; Give the two major...

    (15 pts) Using the following example, int a, p=&a; *p = 20; Give the two major differences of * and & in the above example. (35 pts) Do the following in a program segment step by step. The next step uses the results of the previous step and earlier, using a single statement only and none for manual work. Declare an array called a of float of size 10 and initialize it to 2.5, -3.3, 5.9, 1.0, 3.5, 4.3, -7.3,...

  • program in C - Starter code below //In this assignment, we practice call by reference. //Below...

    program in C - Starter code below //In this assignment, we practice call by reference. //Below description of call by reference is from the following link //https://www.tutorialspoint.com/cprogramming/c_function_call_by_reference.htm //The call by reference method of passing arguments to a function copies //the address of an argument into the formal parameter. Inside the function, //the address is used to access the actual argument used in the call. //It means the changes made to the parameter affect the passed argument. //We use an example...

  • Homework Question Write a void function called transformArray that takes two parameters - a reference to...

    Homework Question Write a void function called transformArray that takes two parameters - a reference to a pointer to a dynamically allocated array of ints, and the size of that array.  The pointer is passed by referencebecause you want to change the value of the pointer. The function should dynamically allocate an array that is twice as long, filled with the values from the original array followed by each of those values times 2. For example, if the array that was...

  • True or False: Algorithms should be specified in pseudocode before they are implemented in C

     17.True or False: Algorithms should be specified in pseudocode before they are implemented in C.  18. True or False: In C, false is defined as any result that is zero. 19. True or False: An advantage to defining functions in C is that they may be reused in other projects. 20. True or False: Suppose a function main calls a function f. As a parameter to f, main passes a pointer p to a struct. Further suppose that f's body modifies p by...

  • Do not use pointer variables, pointer arithmetic or operater new ITCS-2530    Project                        Write an...

    Do not use pointer variables, pointer arithmetic or operater new ITCS-2530    Project                        Write an interactive program that performs fractional calculations. You need define a class CFrac for a fractional number according to the UML diagram below: CFrac - numerator : int - denominator : int - simplify () : void + CFrac (int = 0, int = 1) + ~CFrac() + add (const CFrac&) const : CFrac + subtract (const CFrac&) const : CFrac + multiply (const CFrac&)...

  • Rewrite the program you submitted for A8 to use pointers, pointer notation and arithmetic, etc. as...

    Rewrite the program you submitted for A8 to use pointers, pointer notation and arithmetic, etc. as follows: If you did not complete A8, you will need to start with those instructions, and then, change your code based on the instructions here The main() function should: Create a fixed or dynamic array, e.g., double grade[SIZE] or double *grade = malloc(...) or calloc(...) Concerning the function call for getData(), pass the address of the array and its size to pointers; depending on...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT