On Wed, Mar 12, 2008 at 9:24 AM, xiaoxinchen1989
<[EMAIL PROTECTED]> wrote:
> #include<stdio.h>
> #include<stdlib.h>
> #include<string.h>
>
> int main()
> {
> int n=10;
> char* s=(char*)malloc(sizeof(char)*100);
> char* s2=(char*)malloc(sizeof(char)*100);
> itoa(n,s,10);
> s2="*";
> strcat(s2, s);
> printf("%s", s2);
> system("pause");
> return 0;
> }
It won't even compile on most systems. itoa() is not a standard
function. The line s2 = "*" is invalid also. You have already
allocated memory for s2, you should use strcat or strcpy to put a
string into it.
-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world."
-- Jelaleddin Rumi