Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language input string, and the numbers in the string are stored in an integer array.
C language input string, and the numbers in the string are stored in an integer array.
# include & ltstdio.h & gt

# include & ltstring.h & gt

int? Master ()

{

Charles? str[20];

int? I,j;

int? b[20];

Printf ("Enter string here \ n");

scanf("%s ",str);

for(i=0,j = 0; I & ltstrlen(str);); i++,j++)

{

if((str[I]& gt; 0 ')& amp; & amp(str[I]& lt;' 9'))

{

b[j]=(int)str[I]-48;

printf("%d ",b[j]);

}

Or what? j-;

}

Return? 0;

}

It has run successfully. I hope I can help you. Welcome questions.