Simply, this program is to create a linked list of chars from a string. (say from "HELLO" to head->h->e->l->l->o->NULL)
Whenever I try to delete the head using my erase function, the program would stop working giving the "application.exe has stopped working... Windows is checking for a solution..". I think I might have problem with my memory allocation but I can't really tell. Suggestions greatly appreciated. 

THIS WORKS

```
void StringADT::append(string s)
{ 
for (int i = 0; i < s.length(); i++)
{
    Node* NodePtr;
    Node* newNode;
    newNode = new Node;
    newNode->data = s.at(i);
    newNode->next = NULL;
    if (!head)
    {
        head = newNode;
    } else
    {
        NodePtr = head;
        while (NodePtr->next)
        {
            NodePtr = NodePtr->next;
        }
        NodePtr->next = newNode;
    }
}
}

void StringADT::erase(int pos) //pos = position to erase

{
if (!head || pos < 0 || pos > length() - 1)
    return;
else {
    Node* NodePtr;  
    NodePtr = head;
    if (pos == 0)
    {   
        NodePtr = head->next;

        delete head; //PROBLEM COMES AFTER EXECUTION OF THIS LINE!!

    }
}

```

}

here is my class

```
class StringADT{

private:
    struct Node {
        char data;
        Node* next;
    };
    Node* head;

```

here is my append function which may be the root of the problem because of memory allocation.

```
void StringADT::append(string s) (appending string s to the linked list)
{ 
Node* NodePtr;

int slength = s.length();

Node *NodeArray;
NodeArray = new Node[slength];
if(!NodeArray)
    return;
for (unsigned i = 0; i < s.length(); i++)
{
    NodeArray[i].data = s.at(i);
    NodeArray[i].next = NULL;
}

if (!head)
{
    head = NodeArray;
    NodePtr = head;
    for(unsigned count = 1; count < slength; count ++)
    {
        NodePtr->next = (NodeArray + count);
        NodePtr = NodePtr->next;
        //cout << "number of count " << count << endl;
    }
} else {
    NodePtr = head;
    while (NodePtr->next)
    {
        NodePtr = NodePtr->next;
    }
    for(unsigned count = 0; count < slength; count ++)
    {
        NodePtr->next = (NodeArray + count);
        NodePtr = NodePtr->next;
        //cout << "number of count " << count << endl;
    }
}

```

}