这是我的代码:问题初始化一个struct
typedef struct{
char name[64];
} Cat;
Cat createCat(char name[64]) {
Cat newCat;
int i;
for(i = 0; i < 64; i += 1) {
newCat.name[i] = name[i];
}
return newCat;
}
Cat exampleCat = createCat("Bob");
它编译并出现以下错误:
initializer element is not constant
我在做什么错?
+1,“别的地方” - 里面的方法 – Mysticial 2012-08-06 15:42:48
这仍然只有一半的答案,连同博的它将使一个完美的:) – 2012-08-06 18:25:35
@JensGustedt:但他们没有相同的功能。 – Ryan 2012-08-06 21:59:53