This is the part of code where I want the createNode function to return the node that it creates.
struct Node *ptr = createNode(key); if(keydata) {