Ther's something janky going on here, and it seems to be the xc8 compiler doing funny things with string constants and arrays rather than printf. Leaving aside the printf command for the moment, if I declare & initialise an array it doesn't work if I initialise it like so:
char str1[5] = {'a','b','c','d'};
char str2[5] = {'0','1','2','3','4'}; //this doesn't populate
If you look at the screenshot str1 initialises OK but not str2 (unless I remove the last element) as you can see in the debug. With a correctly populated array I've successfully created/used a sendstring() and also used printf().
I write code infrequently so I have to stop & think every time I have to do it (and having a headcold doesn't help), but that just seems plain wrong to me. I might try gcc as @cv007 suggests - or I might just decide to say FU Microchip and choose another platform (unless of course it's me being stupid not them...).
Those are not string literals, but just array initializers. You need to brush up on your C, first thing, before blaming the tools.
str1 will contain the equivalent of "abcd", because you declare a 5-item char array and since you omit the 5th initializer, the compiler initializes this 5th item to zero, as per the standard. So you end up with something that looks like a C string.
str2 initializes all 5 items of the array, so there is no terminal zero, this doesn't form a zero-terminated string. If you call any function expecting a zero-terminated string, passing str2, anything can happen, including a "crash".
The reason the debugger shows 0xFF for all items of str2 here may be misleading. If you step one more statement in the debugger past SYSTEM_Initialize(), what does it show for str2?
So it's probably just a misleading information, making you make the wrong conclusions.
A zero-terminated string of 5 characters must contain 6 bytes, with the last being zero. And btw, you can use string literals to initialize char arrays in C - no need to list the characters individually.
The correct (and easier to type and read) version would be:
char str2[6] = "01234";
you can alternatively omit the array size here in this declaration, removing the possibility of messing it up:
char str2[] = "01234";