关于用指针调用函数!求解!
#include <iostream>#include <cstring>
using std::endl;
using std::cout;
using std::strlen;
using std::cin;
void main()
{
int ascVal(size_t i, char* p);
int (* pascVal)(size_t, char*)=ascVal;
char* name("my name is fun.");
cout<<endl;
for(size_t a=0;a<=strlen(name);a++)
cout<<name[a];
size_t n(0);
cin>>n;
pascVal( n, name);
return ;
}
int ascVal(size_t i, const char* p)
{
if(!p || i>strlen(p))
return 1;
else
return p[i];
}
错误信息:
1>work.obj : error LNK2019: 无法解析的外部符号 "int __cdecl ascVal(unsigned int,char *)" (?ascVal@@YAHIPAD@Z),该符号在函数 _main 中被引用
1>D:\VC\work\Debug\work.exe : fatal error LNK1120: 1 个无法解析的外部命令