how to find length of character array in c++

char* example = "Lorem ipsum dolor sit amet";
int length = strlen(example);
std::cout << length << '\n'; // 26

3.4
11
Phoenix Logan 186120 points

                                    #include &lt;iostream&gt;

using namespace std;

int main()
{
    char arr[] = &quot;grepper&quot;;
    cout &lt;&lt; sizeof(arr) &lt;&lt; endl;
    return 0;
    //    keep it in mind that character arrays have length of one more than your characters because last one is for \0 to show that word has ended
}

3.4 (10 Votes)
0
3.25
4
Awgiedawgie 440215 points

                                    Instead of sizeof() for finding the length of strings or character 
arrays, just use strlen(string_name) with the header file
#include &lt;cstring&gt;   
it's easier.

3.25 (4 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
finding size of char array c++ length char array in c++ sizeof char array c++ how search character size in array c++ find char array length in c++ find char array length in c+ get length of array of char c++ size of character array c++ how to calculate length of char array in c++ find char length from array c++ how to get size of char array in cpp finding the size of a character array C++ length of a char array in cpp how to get size of character array in c++ size of char array in c++ ++ length of char array length of char array c++ in stdio.h length of char arr cpp length char array c++ size of char arr in cpp how to find length of a character array in c++ find length of char array in c++ how to find the length of a char array in c++ how to find the length of character array in c++ how to determine the size of an char array in c++ how to get size of char array in c++ how to find the length of char array in c++ how to find the size of character array in c++ length of character type array in C++ c++ how much size does char array use how to find out the length of the character array in c++ length of char array in cpp get size of char * array c++ check size of char array c++ how to find size of char array cpp how to find length of a char array in c++ find length of the character array in c++ find length of character array in c++ character array length c++ how to get char array length in c++ char array get length c++ length of character array c++ c++ get char array length find char array lenght c++ size of char array in cpp length of a cahracter array in c++ how to find the length of a character array in c++ get len of char array in c++ char array size in c++ len of char array c++ get the length of a char array in c++ length of array of char in c++ c++ char array get length function to find length of char array in c++ get length char array c++ get size of a char array c++ char array length cpp length of char array in c++ c++ get length of char* array how to get the length of a char array in c++ c++ length of char array c++ length of const char array c++ char arrray length c++ return the size of a char araray c++ get the size of a char array char array size c++ character array of variable size cpp lenght of character array in c++ c++ get length of char array find the length of a character array in c++ size of a char array in c++ get length of character array c++ using length function get length of character array c++ size of character array in cpp c++ size char array build in function to find the length of a char array in cpp check char array length c++ get length of char array c++ find char array size C++ char array c++ length how to find the length of array of char in c++ how to get char array length c++ get char array length c++ c++ len char array c++ char array length c++ char array size c++ size of char array size of char *array [] in c how to find the size of an array in c++ how to get length of string array element in c++ c get the size of a char array char length c programming char ** define length how to know how many character is in a char arrain in c how to find the size of char in an array c program how to find the length of an array in cpp character array size in c++ find size of character array c++ size of array of char in c++ find string length using sizeof taking array size from user in c++ how to find size of list in c++ c++ sizeof char array length of a character array in c++ how to find size of char* size of char array in c c how to get lenght of a char* array c how to get size of char[][] size of char[] c++ how to get a char array size strlen(array, size) find the length of char array in c++ how to find the size of a char* in c length of char array cpp c program size of char array size of char array get char array size c++ how to get size of char* array in c how to get size of char* in c how to find length of character array in c++ sizeof() in c for char array how to find size of array in c++ char array of size N to string c get size of char array how to know the length of char array in c length of char in c how to find size of an character array sizeof char array does sizeof count null how to know the size of a array of char in cpp how to know the size of an array of char in cpp how to find the size of char array in c++ size_t of char array in cpp length of char array c++. length of character array in cpp calculate the size of charr array in c size of chararray in c++ how to find the size of a character array in c how to know the size of a character array in c size of string charater array find size of char array in c how do I get size of char * array in c how to check length of char array in c++ char array with size char array length c++ how to get length of character array in c++ char array size in bytes c++ cpp size of char array how to find length of char array in c++ get size of char array c++ find size of char* c++ c how to get array length of strings how to find size of character array in c++ char array length in c++ c size of char array size W in character array in C means how to get length of char array in c++ find length of char array c++ size of char array c++ c++ find length of char array char array size cpp length of c string c++ how to get the length of a string in a pointer in c how to get the size of a character array in c find size of char array c++ length of char array c++ how to find the size of a character array in c++
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source