In Java and c# you can get the total lenght of an array with
array.length or simular. Not only the length of the filled elements, I want the length of the total array.
Lets say the array is introduced as this.

string array[100];

Maybe its half filled or not it shouldnt matter.
If I in another part of the program want the length (100) without sending 100 as an argument, is that impossible????
Note, I dont care how many elements that are filled, I just want the total length.
Getting crazy here!!

When you pass an array to a function, information about its size is lost (unless the function only takes arrays of a certain size, e.g. void foo( string arr[100] ); instead of void foo( string* arr ) or void foo string[] arr) ).

Since this is a C++ forum, you're much better off using std::array or std::vector (or any other container that suits you needs, which is most likely std::vector).
So the following works fine:

void foo( const vector<string>& bar ) {
   cout << bar.size() << '\n';
}

int main() {
    vector<string> myVec;
    for( int i = 0; i < 100; ++i )
        myVec.push_back( "Hello" );
    foo( myVec );
}

Sad but true. Ok I redefine my functions.
Thanks for the reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.