Invalid write of size 1

you end up with cant_corte[i] is 0, and then you strv[i][cant_corte[i] -1] = '\0';

so strv[i][-1] is not a valid address to write.

i do encourage you to learn how to use valgrind with gdb as explained at http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver-simple

Leave a Comment