Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The purpose of the discussion board is to discuss various topics related to the

ID: 3857930 • Letter: T

Question

The purpose of the discussion board is to discuss various topics related to the readings in order to enhance your understanding. Therefore, it is important that you read discussion board postings, don’t restate what someone has already said, try to further the discussion. It is okay to ask questions, pose ideas, and provide opinions.

Post 4 to 6 paragraphs on ONE of these topics to the week 7 discussion forum by Wednesday evening.

Discussion Question week 7:   Provide detailed example explaining the difference between passing an array to a method by value and passing an array to a method by reference.

OR

What is a jagged array? Describe some circumstances in which jagged arrays might be useful. What do you perceive to be the advantages to using dynamic typing of arrays?

Be sure to cite your references.

Explanation / Answer

Question week 7:-

passing an array to a method by reference :-
Here, we are sending the address of the array.So that , the caller and callee both are using the same array i.e any changes made in the array will be reflected in both places i.e callee and caller function.

passing an array to a method by value:-
Here,we are sending the copy of the array.So,that So that , the caller and callee both are using different array i.e any changes made in the array won't be reflected to the other one

Ex:-

array=[3,4,5]

call-by-reference:-

function:-
xyz(int *arr){
*arr=10;
}

xyz(arr);

now, the function array = [10,4,5]
outer array = [10,4,5]

call-by-value:-

function:-
xyz(int arr[]){
arr[0]=10;
}

xyz(arr);

now,the function array = [10,4,5]
outer array=[3,4,5]