Skip to content

Instantly share code, notes, and snippets.

@zaman
Created December 2, 2010 19:41
Show Gist options
  • Save zaman/725920 to your computer and use it in GitHub Desktop.
Save zaman/725920 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
char *ayikla(char *dizgi)
{
int i,k=0;
char *b;
b=malloc(strlen(dizgi));
for (i = 0; i < strlen(dizgi); i++){
if (isdigit(dizgi[i])){
b[k] = dizgi[i];
k++;
}
}
return b;
}
int main()
{
char *s,*new;
int i;
s="123ab4";
new = ayikla(s);
i = atoi(new);
printf("%d",i);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment