我工作的C++,下面是我的代碼:cpp程序出現意外錯誤?
test.h
char[] defaultSurname = "salunke";
void in_dev(const char* name, char* surname = defaultSurname);
TEST.CPP
#include "test.h"
#include <iostream>
using namespace std;
void in_dev(const char* name, char* surname)
{
cout <<" surname id "<< surname << endl;
}
int main()
{
in_dev("Balaji", "Patil");
return 0;
}
但它提供了以下編譯錯誤:
test.h:1: error: expected unqualified-id before '[' token
test.h:9: error: 'defaultSurname' was not declared in this scope
如何解決此錯誤?
[C++ Arrays](http://www.tutorialspoint.com/cplusplus/cpp_arrays.htm) – 2013-03-04 06:32:19