What is the purpose of the div() library function?

后端 未结 5 2157
一个人的身影
一个人的身影 2020-11-28 16:46

When C has the / operator to divide two numbers, what is the purpose of having the div() library function?

Is there any scenario where /

5条回答
  •  庸人自扰
    2020-11-28 17:04

    div_t is a structure, which contains a quotient member and a remainder member. For example :

    typedef struct {
        int quot;
        int rem;
    } div_t;
    

    Some simple implementations of the div function use / and % operators. You can also see this topic.

提交回复
热议问题