printStackTrace function for C/C++