#include int main(void) { char ansiChar = 'h', *aString = "Computer"; wchar_t wideChar = L'w', *wideString = L"Unicode"; int countNum = -4532; double floatPoint = 432.4536; wchar_t wz [3] = L"AB"; // Zero-terminated wchar_t wn [3] = L"ABC"; // Unterminated, with 'array bound overflow' warning // Display integers printf("Integer formats - Decimal: %d, Justified: %.6d, Unsigned: %u\n", countNum, countNum, countNum); // Display decimals printf("\nDecimal (%d) as - Hex: %Xh, C hex: 0x%x, Octal: %o\n", countNum, countNum, countNum, countNum); // Display in different radixes printf("\nDigits 10 equal to - Hex: %i, Octal: %i, Decimal: %i\n", 0x10, 010, 10); // Display characters printf("\nCharacters in field (1) - %10c%5hc%5C%5lc\n", ansiChar, ansiChar, wideChar, wideChar); wprintf(L"\nCharacters in field (2) - "L"%10C%5hc%5c%5lc\n", ansiChar, ansiChar, wideChar, wideChar); // Display strings printf("\nStrings in field (1) - %25s, %25.4hs, %S%25.3ls\n", aString, aString, wideString, wideString); wprintf(L"\nStrings in field (2) - %25S, %25.4hs, %s%25.3ls\n", aString, aString, wideString, wideString); // Display real numbers printf("\nReal numbers - %f, %.2f, %e, %E\n", floatPoint, floatPoint, floatPoint, floatPoint); // Display pointer printf("\nAddress as - %p\n", &countNum); printf ("%ls\n", wz); // Outputs 6 bytes printf ("%ls\n", wn); // Undefined because wn has no terminator printf ("%4ls\n", wz); // Outputs 3 bytes printf ("%4ls\n", wn); // Outputs 3 bytes; no terminator needed printf ("%9ls\n", wz); // Outputs 6 bytes printf ("%9ls\n", wn); // Outputs 9 bytes; no terminator needed printf ("%10ls\n", wz); // Outputs 6 bytes printf ("%10ls\n", wn); // Undefined because wn has no terminator printf("Color %s, number1 %d, number2 %05d, hex %#x, float %5.2f, unsigned value %u.\n", "red", 123456, 89, 255, 3.14159, 250); printf( "%g", 93000000.0 ); return 0; }