Suppose if an integer array along with some integer number is passed to a function. Then how can we check whether the length of array and the value of the integer number passed are equal or not.
Printable View
Suppose if an integer array along with some integer number is passed to a function. Then how can we check whether the length of array and the value of the integer number passed are equal or not.
Don't use C-style arrays. Use C++ vectors and pass by reference.
C does not support this feature for bare arrays in general.
In the specific case of fixed-size arrays on the stack, it may be possible using templates, but that's really more of a curiosity than anything that would actually be done.
In general you should use a class which wraps the array and stores its size, such as std::vector, or else keep a separate variable around which denotes the array size.
A static array will become part of the upcoming C++ standard. It's already available in namespace std::tr1 in many compilers and it's also in Boost,
http://www.codeguru.com/cpp/cpp/cpp_...le.php/c15257/
k..... thank u guys