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.
Note this accesses memory from high-to-low, which is non-optimal for large address ranges. So I wouldn't call this a Best Practice.
This comment is hidden because it contains spoiler information about the solution
Yes, but no.
Please use decimal "ones" or "zeros" when counting in decimal - binary "ones" and "zeros", though technically the same, don't like it very much to be misgendered that way - because they identify as binary :D
Thats so nice and clean - tried similar, but didn't knew you could use a for-loop as a lazy while-loop like that and I
also wasn't sure if bitshift-equals is a legal expression.
why the use of
size_t
insead ofunsigned
?== 0 is false
< 0 is true ?
how the loop stops when value == 0? can you explain?
This comment is hidden because it contains spoiler information about the solution
many probs
I made such a dreadful solution in comparison to this one
yes, the uint32_t only allow integers without sign, this mean only can be positives
good luck passing your negative values when the params are unsigned ints.
would this still work if we give negative values to m and n?
Should be sizeof(long). The only reason it works is that long is the same size as a pointer on most 64-bit platforms.
Also, p = realloc(p, n) is a bad pattern; if realloc fails, old p is overwritten and you have a memory leak.
Also, calling realloc every time isn't a good idea performance-wise.
On the upside, your code is small, which does matter.
if your current population is equal to the final population, the loop will run 1 last time and it will increase the year count.