When I try compiling the following C code, i get a bus error. I'm guessing it has something to do with the way I have called memcpy, however I cant figure it out. Any help would be greatly appreciated!
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *p = (char*)malloc(sizeof(char)*11);
// Assign some value to p
p = "hello";
char *name = (char*)malloc(sizeof(char)*11);
// Assign some value to name
name = "Bye";
memcpy (p,name,sizeof(char)*10); // Problem begins here
return 0;
}