我想计算字符串的长度,并将值作为字符串传递给函数。
char* s="abcd";
int i = strlen(s);
char* lengthAsString = ????(i);
答案 0 :(得分:4)
char* s = "abcd";
int i = strlen(s);
char lengthAsString[50];
sprintf(lengthAsString, "%d", i);
// now you can use lengthAsString to pass it to a function