当前位置: C语言 -- 标准库 -- <inttypes.h> -- imaxdiv_t

imaxdiv_t类型


描述:

该类型是一种结构类型,表示imaxdiv函数返回值的类型。


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
/*类型imaxdiv_t范例*/

#include <inttypes.h>
#include <stdio.h>

int main(void)
{
    imaxdiv_t divResult;

    divResult = imaxdiv(10,3);
    printf("The quotient is %jd and the remainder is %jd.\n",
           divResult.quot, divResult.rem);

    return 0;
}


输出:

The quotient is 3 and the remainder is 1.


GCC编译器<inttypes.h>头文件中imaxdiv_t类型定义如下:

typedef struct {

  intmax_t quot;

  intmax_t rem;

  } imaxdiv_t;


相关内容:
imaxdiv 计算商和余数的函数。