I'd like to use calloc and snprintf. Can you review my simple code and tell me how to fix it? I kept having an error that Access violation writing location 0xFFFFFFFFB8A2D1F0. Thank you!
int main()
{
char* buffer1;
buffer1 = (char*)calloc(1, 14);
int a = 15;
int b = 25;
char c[]="MON"
int k = snprintf(buffer1, 13, "%02d%02%s", a, b, c);
return 0;
}
Hopefully please fix this simple code.
This works for me:
See https://ideone.com/WMtMQt