I'm working on a project and trying to perform a similar operation as given below, but getting segmentation fault error. I don't understand why it is giving this error, even though I assigned the memory using malloc. Any help on this error is appreciated.
#include <stdio.h>
struct hello{
int i;
};
struct proc{
int j;
struct hello *hello[20];
};
int main()
{
struct proc *proc;
proc->hello[0] = malloc(sizeof(struct hello));
proc->hello[0]->i =10;
printf("value of i: %d\n",proc->hello[0]->i);
return 0;
}