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.
It puts the null terminator at the end of both strings.
Dear Dansaki,
I ve noticed that you store result into static char variable complement;
I would try t store it into char * ptr_complement.
Otherwise you could breach some data in the memory space denoted for static variables
Glad you found it useful!
Psssst! Give this exercise a shot - you will enjoy it.
Happy coding!
This comment is hidden because it contains spoiler information about the solution
I transferred your code to ideone.com and tested it for "abcdea" as the input.
It returns 0 as the value, while the correct solution must return 1 (because 'a' is a duplicate).
Please see https://ideone.com/C9s7JM
After you have fixed your logic, then bring it to codewars. In codewars, you don't need to define a main function.
Good luck,
Hi. Please use markdown tags to format your code or it is very discomfortable to read, see: how-to-format-code-in-markdown.
Moreover it's hard to help you if you don't give more elements of the problems you face: what fails? Do you have some error log, are the results different from what is expected?
This line:
complement[strlen(dna)+1] += '\0';
is not a proper way to set a null string terminator.Please read this: https://docs.codewars.com/training/troubleshooting#post-discourse