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.
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?
Some like to cast
malloc()
's result, some don't. It's a matter of taste, I guess. See e.g. https://en.wikipedia.org/wiki/C_dynamic_memory_allocation#Type_safetytry calloc next time
many probs
I made such a dreadful solution in comparison to this one
if n==0 then result will be a dangling pointer in c.
I think you're right. I think the solution would be to add condition at the beginning that allocates n*sizeof if n>=3 otherwise 3*sizeof.
I think you're right. I think the solution would be to add condition at the beginning that allocates n*sizeof if n>=3 otherwise 3*sizeof.
this should return an error if n = 2 or n = 1
@anaiel signature is an array of size 3 by definition