While working with a static C++ library for my iOS Xcode project, I met a strange behavior with printf and Xcode LLDB debugger, sometimes my print results of printf("%s", char*) was the char concatenated with numbers or garbage characters. The attached image speaks for itself. Any idea?

Seems to work as expected.
%srequires NUL-terminated string, that is, for a givenchar*, print anything until the first'\0'. You have to allocate 5 bytes and assigna[4]=0;if you want your array to be suitable for%s.