|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<iostream>
using namespace std;
#define OK 1
#define ERROR 0
#define TRUE 1
#define FALSE 0
#define MAXSIZE 40
typedef int Status;
typedef int ElemType;
typedef char String[MAXSIZE + 1];
Status StrAssign(String T, char* chars)
{
int i;
if (strlen(chars) > MAXSIZE)
return ERROR;
else
{
T[0] = strlen(chars);
for (i = 1; i <= T[0]; i++)
T[i] = *(chars + i - 1);
return OK;
}
}
int main()
{
int i, j;
Status k;
char s;
String t, s1, s2;
cout << "请输入串s1:";
k = StrAssign(s1, "abcd");
return 0;
}
出现了
E0167 "const char *" 类型的实参与 "char *" 类型的形参不兼容
字符串的类型不是char *,是const char *
Status StrAssign(String T, char* chars)
Status StrAssign(String T, const char* chars)
|
|