Skip to content

Instantly share code, notes, and snippets.

@larryv
Created April 13, 2012 20:03
Show Gist options
  • Save larryv/2379742 to your computer and use it in GitHub Desktop.
Save larryv/2379742 to your computer and use it in GitHub Desktop.
Determine whether a C string consists entirely of digits.
int is_valid_ref(char *arg)
{
do {
if (!isdigit(*arg))
return 0;
} while (*++arg);
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment