why use malloc with structure?
问题 Why would I use malloc when same job can be done by without malloc as below.. #include <stdio.h> #include <conio.h> struct node { int data; struct node *l; struct node *r; }; int main(){ //Case 1 struct node n1; n1.data = 99; printf("n1 data is %d\n", n1.data); //Case 2 struct node *n2 = (struct node *) malloc (sizeof(struct node)); n2 -> data = 4444; printf("n2 data is:%d\n",n2 -> data); free(n2); return (0); } I am having hard time to understand how n1 which is not initialized to memory