为什么我的函数模板会出错?
siegf 2003-11-14 12:07:40 最近学到 C++ Primer 的函数模板一块
为什么我的程序如此的搞不定?是我哪里没学对呢,请各位指教,谢谢了。
#include <iostream>
using namespace std;
template<typename Type>
Type min(Type &m,Type &n)
{
return m<n?m:n;
}
int _tmain(int argc, _TCHAR* argv[])
{
int i=4,j=5;
cout<<min(i,j)<<endl;
cout<<min(5.3,6.4)<<endl;
char *p = main("asdfas","qerwe"); //为什么这句会出错
cout<<*p<<endl;
system("pause");
return 0;
}