#include <stdio.h> #include <stdlib.h> struct node { int data; struct node *next; }; struct node* insert(struct node *root) { root->data = 12; //here return root; } int main() { struct node *root; insert(root); return 0; }
shouldn't program crash @ place have placed comment in insert
function because have not initialized malloc
?
this called undefined behavior never know might happen.crash still possibility.
using uninitialized variabled lead undefined behavior.
Comments
Post a Comment