I want to pass an array by reference from the main functonand the the result com
ID: 3615947 • Letter: I
Question
I want to pass an array by reference from the main functonand the the result come again to the main function becase it isreference passing so i want to further us the array which ismodified after the calling in the main function what should ido? for example: void inut(int[]); void main() { int array1[3]; input(array1); cout<<"Array elements entered by the user are:"<<array1; } void input(int arr1[]) { for(int i=0;i<=2;i++) cin>>arr1[i]; } i have coloured the section where i am confused so pleasetell me what should be written at that place. Thanks. I want to pass an array by reference from the main functonand the the result come again to the main function becase it isreference passing so i want to further us the array which ismodified after the calling in the main function what should ido? for example: void inut(int[]); void main() { int array1[3]; input(array1); cout<<"Array elements entered by the user are:"<<array1; } void input(int arr1[]) { for(int i=0;i<=2;i++) cin>>arr1[i]; } i have coloured the section where i am confused so pleasetell me what should be written at that place. Thanks.Explanation / Answer
please rate - thanks you output the elements individually, same as you input them. When you input a value, always provide a prompt #include using namespace std; void input(int[]); int main() { int array1[3]; input(array1); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.