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.
No, floating point exception, I think that's because I only hardcoded the prime numbers to 100, and didn't use an algorithm to find them.
I don't know, my code runs in my machine, but not in the kata, idk why.
I am using C. Everything ran properly, but when I tried to do
output_str[k++] = some_int + '0';
, I got:I also tried printing the char like so
printf("%c\n", some_int + '0');
everything worked. I tried changing the size of the memory allocated foroutput_str
, no change. I also tried copying another character tooutput_str
like sooutput_str[i++] = '0';
, and it worked...I tried reading the sample test and making change to them, but they didn't do anything that caused undefined behavior.
What's weird is that when I ran it in my machine with
gcc
, it worked. I even tried usingclang
and using flags like-pedantic
,-std=c18
and-Wall
, all of them worked.I've excerted a lot of effort solving this, any my problem was just in copying one character to the outputed string. But at least I've proved to myself that I was a able to do it.
just use memset
just use sprintf