Last active
November 10, 2015 08:18
-
-
Save bzdgn/c47c2866a5ab4bdfa024 to your computer and use it in GitHub Desktop.
Basic printf Functionality Sample
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
#include <stdio.h> | |
int main() | |
{ | |
printf("****************************************************\n"); | |
printf("\n"); | |
printf("64-bit Decimal : %I64d\n", 111222333444); | |
printf("64-bit Hexadecimal: %I64x\n", 111222333444); | |
printf("64-bit Hex Big : %I64X\n", 111222333444); | |
printf("64-bit Hex 2 : 0x%I64X\n", 111222333444); | |
printf("64-bit Hex # : %#I64X\n", 111222333444); | |
printf("64-bit Hex # : %#I64x\n", 111222333444); | |
printf("\n"); | |
printf("****************************************************\n"); | |
printf("\n"); | |
printf("Default Floating : %f\n", 123.456); | |
printf("2digit Floating : %.2f\n", 123.456); | |
printf("10digit wide : %10.2f\n", 123.456); | |
printf("10digit int : %10d\n", 1234567); | |
printf("10digit wide : %-10.2f\n", 123.456); | |
printf("10digit int : %-10d\n", 1234567); | |
printf("\n"); | |
printf("pre %10.2f post\n", 123.456); | |
printf("pre %10d post\n", 1234567); | |
printf("pre %-10.2f post\n", 123.456); | |
printf("pre %-10d post\n", 1234567); | |
printf("****************************************************\n"); | |
printf("\n"); | |
char *message = "Fenerbahce is the number #1!\n"; | |
printf("%s\n", message); | |
int size = 10; | |
printf("%.*s\n", size, message); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment