We have pointers inside a struct, do we need to initialize the pointers inside the struct?
I have tried the code below, include this sentence below or not, the code all run well. (Could some experts give help here? and I read some code, and found seems sometimes initialized, sometimes not, so confused and search/ask here.)
The answer in this link seems not mentioned initialize this pointer inside struct. initializing-a-member-of-a-structure-with-pointers-c
#include "stdio.h"
#include "stdlib.h"
struct part{
    int num;
    char *name;
};
int main()
{
    struct part *p = (struct part*)malloc(sizeof(struct part));
    //Include this or not, this code all run well
    p->name = (char*)malloc(sizeof(char)); 
    p->num = 1;
    p->name = "ss";
    printf("%d, %s\n", p->num, p->name);
    return 0;
}
 
     
    