Code:
#include <stdio.h>
int info(int no) {
printf("no: %d\n", no);
}
int main(int argc, const char *argv[]) {
int (*fp)(int);
fp = info;
printf("function pointer: %p\n", fp);
fp = &info;
printf("function pointer: %p\n", fp);
return 0;
}
From the standard (6.3.2.1/4) :
A function designator is an expression that has function type. Except when it is the operand of the sizeof operator or the unary & operator, a function designator with type ‘‘function returning type’’ is converted to an expression that has type ‘‘pointer to function returning type’’.
Refer to
http://stackoverflow.com/questions/4298654/operator-optional-in-function-pointer-assignment.
分享到:
相关推荐
friend const string & operator+(const string &s1,const string &s2); friend std::ostream & operator(std::ostream &theStream,const string & str); friend const string & operator+(const string &s1,...
Mycomplex& operator=(const Mycomplex& rhs); Mycomplex& operator+=(const Mycomplex& rhs); Mycomplex& operator-=(const Mycomplex& rhs); Mycomplex& operator*=(const Mycomplex& rhs); Mycomplex& operator/=...
void AddTerms(istream& in); void Output(ostream& out) const; void PolyAdd(Polynominal & r); void Polymultip(Polynominal & m); private: Term * theList; friend ostream & operator (ostream &,...
fanuc发那科实用的各种选项功能操作手册,fanuc optional Function operator's Manual
friend ostream& operator(ostream&s,const String&a) { s; return s; } friend istream& operator>>(istream&i,const String&a) { i>>a.str; return i; } ~String(); private: int len; char *str...
" "friend MyComplex operator+(MyComplex m,MyComplex n) ; " "friend MyComplex operator-(MyComplex m,MyComplex n) ; " "friend MyComplex operator*(MyComplex m,MyComplex n) ; " "friend MyComplex operator...
friend std::ostream & operator(std::ostream& os, const TinyString<K>& str); template, size_t L> friend bool operator == (const TinyString<K>& s1, const TinyString<L>& s2); //...... uint8...
../../audio/audio_send_stream.cc(344,25): error: object of type 'absl::optional, TimeDelta>>' cannot be assigned because its copy assignment operator is implicitly deleted frame_length_range_ = ...
friend ostream& operator (ostream& output, const Matrix& zMatrix);//重载 friend istream& operator >> (istream& input, Matrix& zMatrix);//重载 >> Matrix operator + (const Matrix& zMatrix)const;//...
bool operator>(int n,Fraction &c); bool operator>(Fraction &c,Fraction &f); bool operator>=(int n,Fraction &c); bool operator>=(Fraction &c,Fraction &f); bool operator==(int n,Fraction &c); bool ...
对自适应操作概率遗传算法有详细的介绍,有很好的参考价值!
friend istream &operator>>(istream &,Student::student &); friend ostream &operator(ostream &,Student::student &); }; class Teacher{ private: typedef struct teacher{ string name; string sex; ...
CMstring& operator = (const CMstring& lpszstr); operator LPCTSTR() const; bool operator == (const CMstring&) const; bool operator != (const CMstring&) const; bool operator (const CMstring&) const...
string类的构造函数: string(const char *s); //用c字符串s初始化 string(int n,char c);...const char &operator[](int n)const; const char &at(int n)const; char &operator[](int n); char &at(int n);
double& operator()(const size_t& xr,const size_t& xc);//重载()运算符,可作左值 CVector& operator=(const CVector &);//重载=运算符 double operator*(const CVector & )const;//重载*运算符,两向量相乘 C...
friend ostream & operator ( ostream & os, complex & c ); //友元函数:重载 private: double Re, Im; //复数的实部与虚部 }; #endif //复数类complex的相关服务的实现放在C++源文件complex.cpp中 #...
double& operator()(const size_t& xr,const size_t& xc);//重载()运算符,可作左值 CVector& operator=(const CVector &);//重载=运算符 double operator*(const CVector & )const;//重载*运算符,两向量相乘 C...
下面是模拟实现字符串的相关功能,它包括一下功能: String(const char * s);//利用字符串来初始化对象 String(); //默认构造函数 String(const String & s);//复制构造函数,利用String类型来...char & operator[](in
C++数组模板封装,主要成员包括: public: Array(); Array(int size); Array(int size, T value);... template<typename T> friend istream & operator >> (istream & in, Array<T> & vector);
matlab矩阵操作函数,包括矩阵形成函数、常用矩阵操作函数及矩阵运算函数 (matlab matrix operator,include function for generating matrix,matrix operator,matrix caculation)