char *resultstr;
This needs reworking to be a buffer (especially as you’re passing it to sprintf).
So change to
char resultstr[30];
Make the number as large as is needed to hold the result of the variable.
char *resultstr;
This needs reworking to be a buffer (especially as you’re passing it to sprintf).
So change to
char resultstr[30];
Make the number as large as is needed to hold the result of the variable.