Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
|
Convert hexadecimal number to octal number (with decimal intermediary) More...
#include <stdio.h>
#include <string.h>
Macros | |
#define | MAX_OCT_STR_LEN 23 /* 17_7777_7777_7777_7777_7777 */ |
#define | MAX_HEX_STR_LEN 17 /* FFFF_FFFF_FFFF_FFFF */ |
Functions | |
const char * | hex_to_oct (const char *hex) |
for printf() and fgets() More... | |
int | main () |
Main function. More... | |
Convert hexadecimal number to octal number (with decimal intermediary)
The input is valid from 0 to 0xFFFF_FFFF_FFFF_FFFF.
At first, this program converts a hex string to an unsigned long long decimal, and then to an octal string.
When there is an invalid character in input string, this program stops parsing and converts the string until that character.
const char * hex_to_oct | ( | const char * | hex | ) |
for printf() and fgets()
for memset()
Convert a hexadecimal number to octal number.
hex | Hexadecimal number to convert. |
int main | ( | void | ) |
Main function.