how to make a function return a structure pointer in c++
<p>I want to make the function return the address of a particular node .but the compiler is 
not detecting the node datatype structure i created.</p>

<pre><code>struct node
{
int data;

node *link;
};

node *header,*current;
node traverse(int pos);


node *Linkedlist::traverse(int pos)
{
    int location = 0;  
    current-&gt;link = header-&gt;link;
    node *address = new node;
    address-&gt;data = NULL;
    address-&gt;link = NULL;


    while(current-&gt;link != NULL)
    {

        if(location == pos)
        {
            cout &lt;&lt;current-&gt;link-&gt;data &lt;&lt;" "&lt;&lt; endl; 
            address-&gt;link=current-&gt;link;
        }
        location ++;
        current-&gt;link = current-&gt;link-&gt;link;

    }


    return  address-&gt;link;
}
</code></pre>
