Ad
  • Custom User Avatar

    there may be other mistakes, but here is the first that i saw:

    char ccopy[(int) clen], icopy[(int) ilen];
    strcpy(ccopy, code);
    strcpy(icopy, input);
    

    you did not reserve 1 byte for the nul character ('\0') in ccopy and icopy, thus the strcpy() calls are undefined behavior and anything can happen during program execution. (also, variable-length arrays are bad style and should not be used in clean code)

    fix this, and see if your solution works

  • Custom User Avatar

    call your function with this input, and see what happens : "abcde abcde"

    also, style notes: every single cast in your code has no effect. you should use casts more sparingly, and in particular never cast the return of malloc(): it is not only useless but harmful, as it suppresses type checking by the compiler. it is a remnant of the ancient times in which C did not have a void * type, and malloc() returned a char *

  • Custom User Avatar

    At the risk of stating the obvious, but: if you are using some kind of > in your code, have you checked that you are using >= rather than > ?

  • Custom User Avatar
  • Custom User Avatar

    Over 300 solvers in C, so it's probably a problem with your code. Have your tried printing stuff to console (inputs or intermediary steps)? That would be a good place to start.