#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *cp;
cp = (char *)malloc(10 * sizeof(char));
cp="kerem";
//strcpy(cp, "kerem");
printf("%s",cp);
cp=(char *)realloc(cp,30 * sizeof(char));
//strcpy(cp, "kerem demir Aziz Kerem Demir");
cp= "kerem demir Aziz Kerem Demir";
printf("%s",cp);
//free(cp);
return 0;
}
While using the strcpy function, I can copy the pointer string without any problems, but; When I do this using char * I get this error: realloc(): invalid pointer