Horje
how to find length of character array in c++ Code Example
how to find length of character array in c++
#include <iostream>

using namespace std;

int main()
{
    char arr[] = "grepper";
    cout << sizeof(arr) << 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
}
c++ length of char array
char* example = "Lorem ipsum dolor sit amet";
int length = strlen(example);
std::cout << length << '\n'; // 26
how to find the size of a character array in c++
Instead of sizeof() for finding the length of strings or character 
arrays, just use strlen(string_name) with the header file
#include <cstring>   
it's easier.




Cpp

Related
random number of 0 or 1 c++ Code Example random number of 0 or 1 c++ Code Example
how to write something in power of a number in c++ Code Example how to write something in power of a number in c++ Code Example
border radius layout android xml Code Example border radius layout android xml Code Example
random number generator c++ between 0 and 1 Code Example random number generator c++ between 0 and 1 Code Example
c++ ros publisher Code Example c++ ros publisher Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8