P
PSN
Hello everyone,
int main()
{
char *pChar;
pChar = (char *)malloc(16);
memcpy(pChar, "AAAAAAAAAAAAAAA", 16);
printf ("***%s***\n", pChar);
realloc(pChar, 28);
memcpy(pChar, "BBBBBBBBBBBBBBBBBBBBBBBBBBB", 28);
printf ("***%s***\n", pChar);
free(pChar);
return 0;
}
Can someone please explain me why does this crash. what am i doing
wrong ??
Thank you for youri time
Prakash
int main()
{
char *pChar;
pChar = (char *)malloc(16);
memcpy(pChar, "AAAAAAAAAAAAAAA", 16);
printf ("***%s***\n", pChar);
realloc(pChar, 28);
memcpy(pChar, "BBBBBBBBBBBBBBBBBBBBBBBBBBB", 28);
printf ("***%s***\n", pChar);
free(pChar);
return 0;
}
Can someone please explain me why does this crash. what am i doing
wrong ??
Thank you for youri time
Prakash