consider the struct
typedef struct{
int a;
char b;
float c;
const int *ptr;
}check;
in the main function
static check *p= NULL;
p = (check *)malloc(sizeof(check));
memset(p,0,sizeof(check));
now i give values to some members [ thats why i memset to 0 so that all members are init]
int num = 10;
p->a = 1;
memcpy(p->ptr,&num,sizeof(int));
Result: Segmentation fault
Question: how do give value present at "num" and pass it to the ptr?