Home > database >  The title
The title

Time:11-17


Write a function change (char * s, int * p), the number in the string s characters converted to digital storage to integer array p, () function returns the converted digital number,

CodePudding user response:

#include
#include
Int change (char * s, int * p)
{
Int I, j=0;
for(i=0; S [I]!='\ 0'; I++)
If (' 0 '& lt; [I]=s & amp; & S [I] <='9')
{* (p + j)=s [I];
j++;
}
Return j;
}

The main ()
{
Char s [50];
Int p [50], t;
Printf (" input char: \ n ");
Gets (s);

T=change (s, p);

Printf (" digital number is: % d \ n, t);
}
  • Related