Skip to content

Instantly share code, notes, and snippets.

@metrafonic
Created September 16, 2014 14:50
Show Gist options
  • Save metrafonic/719f1fda708f58a1beb1 to your computer and use it in GitHub Desktop.
Save metrafonic/719f1fda708f58a1beb1 to your computer and use it in GitHub Desktop.
C Programming Variables
int main(){
float poop;
int oct;
oct =0x1067;
printf("Demo Integers:\n");
printf("Using: 0x1067\n");
printf("As integer: %i\n", oct);
printf("As oct: %o\n", oct);
printf("As hex: %#x\n", oct);
printf("As hex without leading 0: %x\n", oct);
poop=0.00532;
printf("\n\nDemo Floats:\n");
printf("Using 0.00532\n");
printf("As float: %f\n", poop);
printf("As scientific notation: %e", poop);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment