int main()
{
int main=5;
printf("%d",main);
return 0;
}
In this case there is no error and the gcc compiler prints 5. But if I write
int main()
{
int printf=5;
printf("%d",printf);
return 0;
}
the compiler shows an error..why ?
In your 1st example you "hide" the main
function, replacing it with an int
object.
In your 2nd example you "hide" the printf
function, replacing it with an int
object.
Trying to call an int
is illegal.
5("foo"); /* illegal to call "function" 5 */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With