strlen()
Anonymous contributor
Anonymous contributor24 total contributions
Anonymous contributor
Published Aug 25, 2021Updated Jul 5, 2022
Contribute to Docs
The strlen()
string function returns the length of the string without including the terminating character, '\n'
.
Syntax
strlen(string)
It takes in the string
and returns an unsigned short.
Example
#include <stdio.h>#include <string.h>int main() {char spell[20] = "Abracadabra";printf("Length: %i", strlen(spell));return 0;}
The output would be:
Length: 11
Notice how it didn’t count the terminating character.
All contributors
- Anonymous contributorAnonymous contributor24 total contributions
- christian.dinh2481 total contributions
- Anonymous contributorAnonymous contributor3077 total contributions
- BrandonDusch580 total contributions
- Anonymous contributor
- christian.dinh
- Anonymous contributor
- BrandonDusch
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.