 <pre><code>void print_customers(customer &amp;head); </code></pre> <p>C++ compiler work in top to bottom approach. So, every type, identifier it sees at the point must be known to it. </p> <p>The problem is that compiler doesn't know the type <code>customer</code> in the above statement. Try forward declaring the type before the function's forward declaration.</p> <pre><code>struct customer; </code></pre> <p>Or move the function forward declaration after the struct definition.</p>