Home > Back-end >  To the wrong topic... I don't know how to seek guidance
To the wrong topic... I don't know how to seek guidance

Time:09-21

# include
using namespace std;
Const float pai=3.14159265
Float square (float r)
{
Return the pai * r * r;
}
Float square (float, float length=0)
{
Return high * length;
}
Float (* fs) (float, float=0).
Int main ()
{
Fs=& amp; Square;
Cout<& lt;" The circle 's square is "& lt; }
Float (* fs) (float, float=0). (this sentence is what mean?)

CodePudding user response:

Fs is a function pointer, usage is a little special, I have never seen,

CodePudding user response:

 
Float square (float, float length=0)//function of the second parameter has a default value, the default value belongs to the compiler information, does not affect the function type, its type is float (*) (float, float)
{
Return high * length;
}

Float (* fs) (float, float=0).//define a function pointer called fs, a type of float (*) (float, float), a function pointer to define a function type, not with a default value, error here
Float (* fs) (float, float);//modified

Fs=& amp; Square;//this is for the fs assignment, pointing function square, specific point to which one, depending on the function type, which is clearly points to the second,


  • Related