I was writing a program and looking up strlen() function on this website http://www.cplusplus.com/reference/cstring/strlen/. I saw that in the example where the function was used, the author of the code put (unsigned) to cast the result of the function to unsigned. I understand that it is done so because the function returns size_t type, which is unsigned, but is this really necessary?
/* strlen example */
#include <stdio.h>
#include <string.h>
int main ()
{
char szInput[256];
printf ("Enter a sentence: ");
gets (szInput);
printf ("The sentence entered is %u characters long.\n",(unsigned)strlen(szInput));
return 0;
}