Created
January 6, 2018 12:48
-
-
Save sojohnnysaid/c0b75eac6b7c2031977129f148b7015a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example of how to include the standard IO library in order to use | |
// common functions that allow input and output from the terminal | |
#include <stdio.h> // Include directive gives us access to the .h file | |
int main(void){ | |
char character = 'A'; | |
char string[] = "Hello World"; | |
int number = 42; | |
float my_float = 20.20; | |
// example of format specifiers used for different data types | |
printf("Character:\t%c\n", character); | |
printf("Character Code:\t%d\n", character);//changes the format specifier to %d | |
printf("String:\t%s\n", string); | |
printf("Number:\t%d\n", number); | |
printf("Float:\t%.5f\n", my_float); // using .5 gives us 5 decimal places | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment