strlen returns the number of characters before a string’s first 0 character. It counts the string, not the entire char array, and requires a 0-terminated argument. section 6.1.5
Counting before copying
size_t const len = strlen(argv[0]); char name[len + 1]; memcpy(name, argv[0], len); name[len] = 0; Here, strlen supplies the character count; the extra array element stores the terminating 0 before the copied value is compared with strcmp. section 6.1.5
Keep these constraints visible:
- A string must contain a terminating 0 character; using strlen on a non-string has undefined behavior. section 6.1.5

