Skip to content

Instantly share code, notes, and snippets.

@calvinfroedge
Created February 20, 2012 03:49
Show Gist options
  • Save calvinfroedge/1867678 to your computer and use it in GitHub Desktop.
Save calvinfroedge/1867678 to your computer and use it in GitHub Desktop.
Char to int conversion
#include "stdio.h"
int main()
{
char c = 'a';
int d, e;
d = c - 'a';
e = c;
printf("%d", d); //Evalutes to 0. Trippy!
printf("%d", e); //Evaluates to 97 - the ASCII value.
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment