3 回答
TA贡献1757条经验 获得超7个赞
const char *a[2];a[0] = "blah";a[1] = "hmm";
const char
"blah"
"hmm"
.
char a[2][14];strcpy(a[0], "blah");strcpy(a[1], "hmm");
char
TA贡献1799条经验 获得超8个赞
char strs[NUMBER_OF_STRINGS][STRING_LENGTH+1];...strcpy(strs[0], aString); // where aString is either an array or pointer to charstrcpy(strs[1], "foo");
char strs[NUMBER_OF_STRINGS][STRING_LENGTH+1] = {"foo", "bar", "bletch", ...};
char *strs[NUMBER_OF_STRINGS];
char *strs[NUMBER_OF_STRINGS] = {"foo", "bar", "bletch", ...};
strs[i] = "bar";strs[i] = "foo";
strs[i] = "bar";strcpy(strs[i], "foo");
strs[i] = malloc(strlen("foo") + 1);strcpy(strs[i], "foo");
char (*a[2])[14];
- 3 回答
- 0 关注
- 384 浏览
添加回答
举报