in the following program:
int main()
{
struct Node node;
struct Node* p = (Struct Node*) malloc(sizeof(struct Node));
*p =node;
printf("%d\n", *p->seq);
}
usually I did memcpy(p, node, sizeof(node))
now I tried the code above, and it works fine, I'm afraid there are any consequence or faulty stuff if I do assignment but not memcpy
after malloc
.
are there any or the assignment is very correct?
thanks!