Passing unknown Array to Function by reference (C++) -
I've spent a great time trying to understand - how do I write this function (at the top of the code - insertionsort ) Which allows me to pass an array from its context. One way is to allow me to call 'size' on the array. This should be an array for this assignment.
I have not tried to pass it through context, delete the array before calling the shape on it, etc. I am getting errors: (.
This is the most recent compiler error for code:
EnterSort. Cpp: 11: Error: Parameter '' A ' Contains the references to the unknown bound array ?? int [] a ???? insertion STPP: zero zero entry in function (int (and) []): Combination code CPP: 13: error : In the shape of the "size" request for the member (int ), which is a non-square type ??? INTream & lt; iostream & gt; // # added or However, since this is only an indicator of the base type, there is no member function to call it and there is no clue It is beyond what the memory structure looks like (i.e. there is no concept of length) If you wanted to know the length of a dynamic array that was passed to you, then you need to pass the length in the form of the second parameter, possibly the length of the array that has been created should be known. Or, you can avoid all this and use vectors which are Java Are similar to an ArrayList.
void foo (int * array)
void foo (int array [])
void foo (int * array, unsigned integer length)
Comments
Post a Comment