Skip to content

Instantly share code, notes, and snippets.

@CN6033
Created March 17, 2015 12:48
Show Gist options
  • Save CN6033/774944b0c136ef0e815c to your computer and use it in GitHub Desktop.
Save CN6033/774944b0c136ef0e815c to your computer and use it in GitHub Desktop.
How strlen() function works.
size_t strlen(char const * s)
{
size_t len = 0;
while(*s++) {
len++;
}
return len;
}
/*
"\0" is a character, the null character with ASCII value 0.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment