<dfn id="lvnb7"></dfn>

    <dfn id="lvnb7"></dfn> <address id="lvnb7"></address>

          <ruby id="lvnb7"></ruby>

            <delect id="lvnb7"><strike id="lvnb7"></strike></delect>

              header

              <cinttypes> (inttypes.h)

              C integer types
              Header with library support for width-based integral types.

              Including this header automatically includes also <cstdint> (which defines width-based integral types).

              Macros

              The following macros expand to character string literals that contain a printf or scanf specifier suitable to be used with specific width-based integral types:
              macrodescriptionexample
              PRIxMAXprintf specifier for intmax_tPRIiMAX is the equivalent of i (in "%i") for intmax_t values
              PRIxNprintf specifier for intN_tPRId16 is the equivalent of d (in "%d") for int16_t values
              PRIxLEASTNprintf specifier for int_leastN_tPRIuLEAST32 is the equivalent of u (in "%u") for uint32_t values
              PRIxFASTNprintf specifier for int_fastN_tPRIxFAST8 is the equivalent of x (in "%x") for uint8_t values
              PRIxPTRprintf specifier for intptr_tPRIuPTR is the equivalent of u (in "%u") for uintptr_t values
              SCNxMAXscanf specifier for intmax_tSCNiMAX is the equivalent of i (in "%i") for intmax_t values
              SCNxNscanf specifier for intN_tSCNd16 is the equivalent of d (in "%d") for int16_t values
              SCNxLEASTNscanf specifier for int_leastN_tSCNuLEAST32 is the equivalent of u (in "%u") for uint32_t values
              SCNxFASTNscanf specifier for int_fastN_tSCNxFAST8 is the equivalent of x (in "%x") for uint8_t values
              SCNxPTRscanf specifier for intptr_tSCNuPTR is the equivalent of u (in "%u") for uintptr_t values
              Where:
              • x is one of d, i, o,u or x (for the printf specifiers this can also be an uppercase X).*
              • N is 8, 16, 32, 64, or any other type width supported by the library in <cstdint>.
              * The specifier assumes the type to be signed for i and d, and unsigned for o, u, x and X.

              Functions

              This header also declares the following functions, that adapt functions in <cstdlib> and <cwchar> for intmax_t:
              functiondescription
              imaxabsequivalent to abs for intmax_t:
              intmax_t imaxabs (intmax_t n);
              imaxdivequivalent to div for intmax_t:
              imaxdiv_t imaxdiv (intmax_t numer, intmax_t denom);
              strtoimaxequivalent to strtol for intmax_t:
              intmax_t strtoimax (const char* str, char** endptr, int base);
              strtoumaxequivalent to strtoul for uintmax_t:
              uintmax_t strtoumax (const char* str, char** endptr, int base);
              wcstoimaxequivalent to wcstol for intmax_t:
              intmax_t wcstoimax (const wchar_t* wcs, wchar_t** endptr, int base);
              wcstoumaxequivalent to wcstoul for uintmax_t:
              uintmax_t wcstoumax (const wchar_t* wcs, wchar_t** endptr, int base);

              In C++, including this header also provides overloads of abs and div for intmax_t (equivalent to the functions above) unless intmax_t is an alias of a fundamental type.

              Types

              Typedescription
              imaxdiv_tType returned by imaxdiv, which is the div_t equivalent for intmax_t.

              Example

              1
              2
              3
              4
              5
              6
              7
              8
              9
              10
              11
              12
              13
              14
              15
              16
              17
              18
              19
              20
              21
              22
              23
              /* example of <inttypes.h> */
              #include <stdio.h>      /* printf, scanf, fgets, stdin, NULL */
              #include <stdint.h>     /* intmax_t */
              #include <inttypes.h>   /* strtoimax, PRIdMAX, SCNdMAX */
              
              int main ()
              {
                char buffer[80];
                intmax_t foo,bar;
              
                printf ("Please, enter a number: ");
                fgets (buffer,80,stdin);
                foo = strtoimax (buffer,NULL,10);
              
                printf ("Thanks for entering %" PRIdMAX ".\n", foo);
              
                printf ("Please, enter another number: ");
                scanf ("%" SCNdMAX,&bar);
              
                printf ("%" PRIdMAX " by %" PRIdMAX " is %" PRIdMAX, foo, bar, foo*bar);
              
                return 0;
              }


              Possible output:
              
              Please, enter a number: 10
              Thanks for entering 10.
              Please, enter another number: 20
              10 by 20 is 200
              
              最好看的2018中文字幕_亚洲欧美日韩一区_国产欧美亚洲综合第一区_欧美日韩视费观看视频