imaxdiv函数
概要:
#include <inttypes.h> imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
描述:
该函数通过一次运算计算出(numer/denom)和(numer%denom)的值。
参数:
intmax_t numer
参数为一个intmax_t类型的整数。
intmax_t denom
参数为一个intmax_t类型的整数。
返回值:
函数返回一个imaxdiv_t类型的结构,该结构包含两个成员:商(quot)和余数(rem),成员类型均为imaxdiv_t类型,成员在结构中的顺序ISO/IEC 9899:2018标准未作规定。如果结果的任何部分不能正常表示,函数行为是未定义的。
范例:
|
|
输出:
The quotient is 3 and the remainder is 1.
相关内容:
imaxdiv_t | 表示imaxdiv函数返回值的类型。 |