1char* example = "Lorem ipsum dolor sit amet";
2int length = strlen(example);
3std::cout << length << '\n'; // 26
1#include <iostream>
2
3using namespace std;
4
5int main()
6{
7 char arr[] = "grepper";
8 cout << sizeof(arr) << endl;
9 return 0;
10 // 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
11}
12
1Instead of sizeof() for finding the length of strings or character
2arrays, just use strlen(string_name) with the header file
3#include <cstring>
4it's easier.