#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char *a = "kitty";
const int a_length = strlen(a);
char *my_kitty = malloc(a_length);
strcpy(my_kitty, a);
printf("%s\n", my_kitty);
return EXIT_SUCCESS;
}
What is wrong with this code? Null check for malloc? I am kind of confused about pointers.