4 ms·
Why not break them out into separate functions? Use the comments to name these functions. Each comment is a hidden function. Also this will reduce code duplicat
by asimjalis 19y ago
Why not break them out into separate functions? Use the comments to name these functions. Each comment is a hidden function. Also this will reduce code duplication? For example,
char* findEnd( char* s)
{
while( *s ) s++;
return s;
}
bool endsWith( const char* haystack, const char* ending )
{
// find the end of [haystack] and [ending].
const char *haystackEnd = findEnd(haystack);
const char *endingEnd = findEnd(ending);
// Etc.
}