Skip to content

Instantly share code, notes, and snippets.

@sayz
Created November 21, 2010 13:13
Show Gist options
  • Save sayz/708729 to your computer and use it in GitHub Desktop.
Save sayz/708729 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
int main()
{
int i, j;
char dizgem[] = "123ab4";
char tmp[1];
char depo[6]= "";
for(i = 0; i < strlen(dizgem); i++){
if(isdigit(dizgem[i]) != 0){
tmp[0] = dizgem[i];
tmp[1] = '\0';
strcat(depo, tmp);
}
}
j = atoi(depo);
printf("%d", j);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment