[ create a new paste ] login | about

Link: http://codepad.org/zBIfrFwz    [ raw code | output | fork ]

C, pasted on Sep 20:
#include <stdio.h>
#include <ctype.h>
void del_digit(char str[]) {
  int i, j;
  i = j = 0;
  while (str[j] != '\0') {
    if (!isdigit(str[j])) {
      str[i] = str[j];
      i++;
    }
    j++;
  }
  str[i] = '\0';
}

int main() {
  char str[] = "ab1c23d";
  printf("%s\n", str);
  del_digit(str);
  printf("%s\n", str);
  return 0;
}
/* end */


Output:
1
2
ab1c23d
abcd


Create a new paste based on this one


Comments: