-
-
Quote:
Originally Posted by
transgalactic2
why only ptr=add;
Code:
why not ptr=add(int x,int y); //add is a function we cant hide its signature
//what if there were two add function but with different signatures
//in such case this line will create an error
??
Because that is a declaration, not an assignment.
It's also possible to create several functions with different parameter lists (with the same name). It's called overloading and is available in C++, but not C.
-
Well it isn't a declaration either (just to be clear). The code is a mistake if we want to call it anything. The reason you can't do that is because it isn't a valid C statement, and that will stop the compiler every time.