Search code examples
arrayscstrlen

Finding the length of a Character Array in C


What is a way in C that someone could find the length of a character array?

I will happily accept pseudo-code, but am not averse to someone writing it out if they'd like to :)


Solution

  • Provided the char array is null terminated,

    char chararray[10] = { 0 };
    size_t len = strlen(chararray);