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.
Braces are optional (and therefore not used here) when there is only one statement inside the loop block. This implies that the return statement executes only after the while loop has completed. Hope this helps.
I know this is old but if it were in the while loop, then it would return the list as it is after the 1st loop because how the return statement works. once you return something, you are exiting out of the program and it does not go back. You only want it to return once you know you have the full correct answer at that point.
Think of it as any method that returns either a 1 or a 0. The implementation of it in this case is arbitrary since it is implemented by the caller and not within the method that is being tested.
This comment is hidden because it contains spoiler information about the solution
they're 3D, not 2D ;-) your box would be 2 * 1 * 0
The explanation was great, and all my doubts were solved!
This comment is hidden because it contains spoiler information about the solution
Hi,
Here pass the address of res (this is the reason for &res, it is required by asprintf), then store the string in res.
This function is similar to sprintf, the difference is you don't have to worry about allocating the space needed to hold the string, asprintf takes care of it directly for you.
For more details see the links below:
https://c-for-dummies.com/blog/?p=3934
https://linux.die.net/man/3/asprintf
Remember that the difference between &res and *res is as follows:
&res returns the address of res.
*res returns the first character pointed to by res.
I hope I was helpful :)
This comment is hidden because it contains spoiler information about the solution
In Java it is needed to avoid integer arithmetic. But here maybe it was redundant.
It will be more productive over an online session.
If you are interested, write me at lifebalance at gmail dot com.
Alternatively, I can start explaining here as well, if that's your preference.
This comment is hidden because it contains spoiler information about the solution