Possible Duplicate:
How to convert integer to string in C?
I would like to calculate the length of the string and pass the value to a function as a string.
char* s="abcd";
int i = strlen(s);
char* lengthAsString = ????(i);
Possible Duplicate:
How to convert integer to string in C?
I would like to calculate the length of the string and pass the value to a function as a string.
char* s="abcd";
int i = strlen(s);
char* lengthAsString = ????(i);
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