strlen implementation from scratch

tux4life 0 Tallied Votes 241 Views Share

This is how mine strlen function would look like if I'd to implement it from scratch :)

/**
@author: Mathias Van Malderen (tux4life)
*/
size_t strlen(const char *s)
{
    size_t sz = 0;
    while(*s++) sz++;
    return sz;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.