62 560
Assignments Done
98,8%
Successfully Done
In June 2018

Answer to Question #3189 in C++ for Babi

Question #3189
I am trying to call an array but it is not being called through a method.
Expert's answer
Your method must be like this:

void /*or any other type of return data*/ your_method_name(int* a /*and if you need other input data*/) {
// a - it's input array (pointer for first element in array)
// working wit array (for example your array will contain data {3, 2, 1, 0} ):
cout<<(*a)<<endl;
//outpun number wiil be 3, because *a it's pointer for first element in array
cout<<(*(a+1))<<endl;
//outpun number wiil be 2, because *(a+1) it's pointer for second element in array
cout<<(*(a+2))<<endl;
//outpun number wiil be 1, because *(a+2) it's pointer for third element in array
cout<<(*(a+3))<<endl;
//outpun number wiil be 0, because *(a+3) it's pointer for fourth element in array
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions