Skip to content

Instantly share code, notes, and snippets.

@fsouza
Created May 10, 2012 01:29
Show Gist options
  • Save fsouza/2650302 to your computer and use it in GitHub Desktop.
Save fsouza/2650302 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int
discover_value(int value)
{
if (value >= '0' && value <= '9') {
return value - '0';
}
return value;
}
int
dumb_sum(int x, int y)
{
return discover_value(x) + discover_value(y);
}
int
main(void)
{
printf("%d\n", dumb_sum('2', 2));
printf("%d\n", dumb_sum(50, 2));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment