Answers for "find the length of char array in c++"

C
2

length of a char array in c

char chararray[10];
size_t len = strlen(chararray);
Posted by: Guest on May-24-2020
3

c++ length of char*

#include <iostream>
#include <string.h>

using namespace std;

int main()
{
    char *str = "ABC";
    cout << strlen(str) << endl;
    return 0;
}
Posted by: Guest on August-01-2020
1

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
}
Posted by: Guest on November-27-2020

Code answers related to "find the length of char array in c++"

Code answers related to "C"

Browse Popular Code Answers by Language