Why do we need void functions? : <p>Is there any fathomable reason why we need void functions?</p>

<p>For the same reason that <code>int main()</code> is a standard, why not simply return <code>0</code> from a function that doesn't require a return value? I see three immediate advantages to using an <code>int</code> type:<br>
1. We can return a code to indicate function status; typically, if there's a problem, we can return a non-zero error code.<br>
2. We can output the return value of the function when debugging<br>
3. It's the standard for the main() routine; that is, <code>int main() {}</code>. Why not follow suit?  </p>

<p>Is there any reason why we'd prefer <code>void</code> over <code>int</code>?</p>

<p>Example: A function that sorts an array of cheeses, and returns it by reference.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string.h&gt;

int sortArrayInt(string &amp; _cheese[]) { // pun intended ;D
    int errCode = 0;
    try {
        // ..sort cheese[] array
    } catch(e) {
        errCode = 1;
    }
    return errCode;
}

void sortArrayVoid(string &amp; _cheese[]) {
    // .. sort cheese[] array
    // no return code to work with, doesn't follow int main() standard, and nothing to output.
}

int main() {
    string cheese[5] = {"colby","swiss","cheddar","gouda","brie"};
    std::cout &lt;&lt; "Sort Status: " &lt;&lt; sortCheeseArrayInt(cheese) &lt;&lt; std::endl;
    sortArrayVoid(cheese);
    // ..print cheese array
}

OUTPUT:
Sort Status: 0
brie, cheddar, colby, gouda, swiss
</code></pre>
