Is it acceptable to type-cast the return value of a C function?
<p>A colleague of mine claims that type-casting the return value of a function is undefined in C, however I cannot find anything to support his claim.</p>

<p>I know that type-casting a function pointer is bad, see here:
<a href="https://stackoverflow.com/questions/559581/casting-a-function-pointer-to-another-type">Casting a function pointer to another type</a></p>

<p>But I want to confirm that the following code would be acceptable and well defined:</p>

<pre><code>// Some function
int ret = foo(bar);

// Some variable with some different type
unsigned int a;

// Cast function result to match variable type
a = (unsigned int) foo(bar);
</code></pre>