I have written a simple program that runs OK within Visual Studio 10 (both Debug and Release), but it crashes when I run the program directly from the command line.
I think I have narrowed it down to malloc, but the crash doesn't make sense to me.
I have worked it out! I wasn't allowing the extra byte for the NULL termination in the string, so the program was writing to invalid memory.
Does anyone know:
1) Why only the second instance caused a problem?
2) Given that it was actually code following the last line shown on my snippet, why the "Malloc Complete" line wasn't printed?