The provided C code is a version of the C string library function strlen(), which calculates the length of a given string.
unsigned int mystrlen(char *c) { unsigned int i = 0; /* Your code here. */ }
Which line of code creates a working and accurate version of strlen()?
if (*c == '\0') { return i; } else { return mystrlen(++c) + 1; }
if (*c == '\0') { return i; } else { return mystrlen(c++) + 1; }
while (*(c + i) != '\0') i++; return i;
while (*(c + i) != '\0') ++i; return i;
64.3k questions
77.9k answers
244k comments
80.0k users