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.
In Python is very simple
Example
age = int(19)
txt = str("Hello my name is Beno, i'am {} years old")
print(txt.format(age))
Added const for the char* r
That's just a formatting preference. What's I think is a bad formatting preference is putting anything after a scope-closing } on the same line.
Just a minor Feedback:
if you're using the curlybrackets, then put them in the next row so the code is simpler to read.
char fanis(char r, int k) {
for (; *r; *r++)
*r = k + *r;
return r;
}
I did this too... But I'm not sure it was the intended solution.
I used this way too =)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Simple as
The point of this was mostly just an excuse for me to have some fun golfing with no fear of undefined behaviour, sorry for not making that very clear.
Now I may be wrong here, but since when does malloc initialize contents of memory? AFAIK it could, but doesn't have to, and malloc(0) is a very specific case (implementation dependent) - it may either return NULL or a non-NULL pointer.
https://softwareengineering.stackexchange.com/questions/411166/why-would-you-ever-use-malloc0
I do believe that "already being a NULL was lucky" applies to your code as well - IMO both cases passed the test thanks to linux kernel.
https://stackoverflow.com/questions/45323930/is-malloc-initializing-allocated-array-to-zero
AFAIK the correct option should use calloc.
(Also your code could use some whitespaces after comas and semicolons or around operators . Readability is quite poor.)