Implicit Casting of Variables

The C language will in some cases implicitly cast variables of one type into another. Sometimes this is a good thing (it saves the programmer from having to perform this task), but it can have unintended behavior.

Perhaps the worst implicit cast is that of pointer-to-integer.
void sort( int ar[] , int size )
{
/* code to sort goes here */
}
int main()
{
int array[ 10 ];
sort( 10 , array );
}

No comments:

Post a Comment