[ create a new paste ] login | about

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

C, pasted on Dec 7:
#include <stdio.h>
#include <ctype.h>

int delnum(char *p, const char *str)
{
    int n;
    
    for (n = 0; *str; str++) {
	isdigit(*str) ? n++ : (*p++ = *str);
    }
    
    return n;
}

int main()
{
    char buf[256];
    
    int n = delnum(buf, "asdf12afd");
    
    printf("n= %d, %s\n", n, buf);

    return 0;
}


Output:
1
n= 2, asdfafd@


Create a new paste based on this one


Comments: