Suppose that p is a value parameter ot type int*. What happens when a function d
ID: 3665204 • Letter: S
Question
Suppose that p is a value parameter ot type int*. What happens when a function does an assignment to *p When should a pointer parameter be a reference parameter Suppose that an array is passed as a parameter. How does this differ from the usual use of a value parameter Write the prototype tor a function called make_ intarray. The function takes two reference parameters: a pointer that will be used to point to the array,and size_t data type to indicate the size of the array.Write a function with one reference parameter that is a pointer to an integer. The function allocates a dynamic array of n integers, making the pointer point to this new array. It then fills the array with 0 through n - 1.Why do average and compare on page 175 use the keyword const with the data array, but f fill_array does not Write a function that copies n elements from the front of one integer array to the front of another. One of the arrays should be a const parameter, and the other should be an ordinary array parameter.Describe in English the behavior of the program in Figure 4.7.Explanation / Answer
Answer: 8) When you are passing this int * to a function then if you assign a value to the variable by *p = 19; for example. Then this value is directly changed in the area of memory where it is stored. So When a function assigns a value to *p = 19 for example. Then in the calling function also the change will be reflected.
Answer: 9) A pointer can be re-assigned any number of times while a reference can not be re-seated after binding.
Pointers can point nowhere (NULL), whereas reference always refer to an object.
You can't take the address of a reference like you can with pointers.
Answer:10) An array name stores the starting address of the first element. So when you are passing an array to a function actually you are passing arguments by reference, but where as if you pass an ordinary variable, you are passing by value.
Answer:11) Proto type is as follows
make_intarray( int p[], size_t * size);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.