Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
;D
:-)
:-)
Breaks aren't necessary here since the function ends when return is called.
I have an assumption that a compiler is likely to optimize the calls to sqrt by making the result a variable in the compiled program anyway. I heard it similarly does this with repeated strlen calls. While it would be good practice to tell the compiler to do that explicitly, it's unlikely to matter in the end anyway, right? And that's besides the question of whether this solution is meant as a code golf solution. Since best practice and code golf are often the antithesis of eachother.
How the hell? O.o
This comment is hidden because it contains spoiler information about the solution
You can tell sscanf to ignore a segment by adding * to the format specifier.
sscanf(ip, "%*d.%d.%d.%d", lowies, lowies+1, lowies+2);
This saves an extra unsigned variable.
If
i=0
, then accessingnums[i-1]
should cause an invalid memory access resulting in undefined behaviour.Sorry, must try harder next time.
A solution from dinglemouse that isn't code-golfed to 5 characters in length? I feel like I've just witnessed something rarer than the birth of the universe. ;)
Best not to allocate
arr
witha
when you need 3 ints.If there are only 2 family members the
arr[2]
write will be into unallocated memory.Loading more items...