I am trying to call an array but it is not being called through a method.
1
Expert's answer
2011-06-20T11:50:17-0400
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 }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment