5 Ways to find length of an array in c++ including character array
5 WAYS to find Length of an ARRAY data-type in C++ Using sizeof( ) function Counting element - by- element also known as Traversing a)Char array b) other data type arrays like int,float Using size ( ) function in STL Using begin ( ) and end ( ) Using Pointers 1. Using Sizeof( ) operator: In C++, the sizeof operator is used to determine the size of a variable or data type in bytes. The operator can be used with variables, arrays, or data types. When used with a variable, sizeof returns the number of bytes occupied by the variable in memory. We will discuss this keeping arrays in our mind only. Example of using sizeof( ) to find the array length. * same technique can be used on character arrays Output: 2.1 Counting elements by traversing the array Note: This works in Char array only 2.2 Other way of traversing whole array. Output: 3. Using size( ) function in STL Alternatively, We can use std::array instead of a raw array, which has the size() function. We can not use R...