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.
Seems harder than a 8kyu
Pretty good kata.
Very nice kata, compliments.
.
This kata is available in almost 20 languages. Some of those use lists, others use arrays, sequences, vectors, .. it can seem like every language invents its own word for "list" ( also depending on the implementation ).
Sometimes you have to read a description ( or initial code ) and translate concepts to your language of choice yourself.
The name of the parameter is misleading, it should be list not arr(array)
Agree
Why do you believe it's allocated with
malloc()? It's not, it is a regularintthat is passed by reference to your function.I'm understand now. There was reserved an empty space with malloc
that I need to fill with some value.
You seem to be a bit confused about how output parameters work. In this challenge, the pointer
firstwill always point to a valid location which can hold anintvalue. You solution has to use this location and write anintvalue into it. The pointer is always valid, but the pointed value is undetermined and your solution has to fill it in.I thought that it must be point to NULL
and only the answer will change it to a valid int.
Does it happen that
firstis a null pointer? It seems to be defined by the setup as a not-optional output parameter, and, as such, it will always be passed as a pointer to a validint?Hello.
For C language, if int* first is a null pointer, why *first = arr[i] works?
It must be null pointer dereferencing mistake.
This should really be a 7kyu. ( So if you find it hard for an 8kyu, that might be correct. )
Don't hold your breath everyone, but I'll raise the issue at the appropriate place.
Loading more items...