In post number 4, in line 77, the bracket that closes is of the for loop with the j counter. Thus, when you reach the printf's of w, counter j has the value size (because the condition is j<size in the for loop). As a result, you are reading memory that does not have what you think it does. By chance, this memory is yours and the program does not crush. :)
So, you should rethink about counter j.