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.
The problem may be that when you allocate your char array with
c = (char *)malloc(sizeof(char) * (i + 1));
, you are not setting the last elementc[i]
to 0 (or'\0'
). Remember thatmalloc
does not initialize any memory, it only allocates it (butcalloc
will initialize to 0). This can cause a problem withstrcmp
since it compares the strings up until it reaches 0 on one or both of them.