How do I print _Decimal32, _Decimal64, and _Decimal128 in C? (Also, what is a Printf hook and how do I add one?)

62 Views Asked by At

I'd like to print _Decimal32, _Decimal64, and _Decimal128 with Printf. I'm using Code::Blocks, GCC and MinGW w64. How do I add the required print hooks, and what is the hook for each one?

I tried adding printf hooks. However, I don't know how to this. Can they be added globally? I've also tried to %D (_Decimal64), %H (Decimal32) and %DD (Decimal128). I'd like to implement all 3.

Here is my code.

#include <stdio.h>
#include <stdlib.h>
_Decimal64 main()
{
    _Decimal64 decim = -9.5;
    printf("%D", (decim));
    return 0;
}

As you can see, it returns D.

0

There are 0 best solutions below