int dubs_checker_set_num ( dubs_checker_t * dubs_checker, unsigned long long int num) { ( * dubs_checker ) . num=num ; return 1; }
int dubs_checker_check ( dubs_checker_t * dubs_checker ) { unsigned long long int num = ( * dubs_checker) .num ; return num > 10 && num % 10 == ( num / 10 % 10 ) ; }
Name:
Anonymous2016-02-07 22:25
Just look at the freaking numbers, who needs a computer to check their dubs?
Luddites, unite!
Name:
Anonymous2016-02-07 23:58
Your dubs checker only checks for base 10 dubs... dubs in other bases deserve equal treatment fucking racist!.
You're missing a few more levels of superfluous indirection and design patterns for it to be truly "modern".
Name:
Anonymous2016-02-09 21:20
>>3 Exactly. To solve this, I would create a base ``dubs_checker" and simply extend this for all radixes. Then you can use basic dependency injection for testing and whatnot.