Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language converts plastic arrays into character arrays.
C language converts plastic arrays into character arrays.
Oh, my God, this is an integer array. Oh, my God. You want to convert 123 of int into 123 of character type, right? Is there a function called itoa () ()? You can use it directly If you want to write it yourself, you can use my following program:

# include & ltstdio.h & gt

char *fun(int n,char *str)

{

int m,l=0,I;

m = n;

And (m! =0)

{

m = m/ 10;

l++;

}

for(I = l; I & gt=0; I-)

{

If (i==l)

{

str[I]= ' \ 0 ';

}

other

{

str[I]= n % 10+48;

n = n/ 10;

}

}

Returns a string;

}

int main()

{

int a;

char str[ 10]= { 0 };

Printf ("Enter a number: \ n");

scanf("%d ",& ampa);

puts(fun(a,str));

Returns 0;

}