SyntaxFix
Write A Post
Hire A Developer
Questions
How about (works also for 0 and negatives):
int digits( int x ) { return ( (bool) x * (int) log10( abs( x ) ) + 1 ); }