/* DigitsTONumber.c */
/* Convert a string of digits (S) to a non-negative integer */

#include <stdio.h>
int CONV(char*);

void main(void)
{
 char S[] = "123456789x"; int K;
 K=CONV(S);
 printf("%d\n",K);
 getchar();
}

/********************************************************/

int CONV(char *P)
 {
  int K;

  K=0;
  while ((*P>='0')&&(*P<='9')) {K=10*K+(int)*P - 48; P++;}
  return K;
 }
