Skip to content

Instantly share code, notes, and snippets.

@zaman
Created December 2, 2010 20:00
Show Gist options
  • Save zaman/725946 to your computer and use it in GitHub Desktop.
Save zaman/725946 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main()
{
char *s,*p;
int i,k=0;
s="+,- 1234";
p=malloc(strlen(s));
for (i = 0; i < strlen(s); i++){
if (s[i] >= '0' && s[i] <= '9')
p[k++] = s[i];
}
printf("+%s\n",p);
printf("-%s",p);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment