Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

What's the difference between "mod" and "remainder"?

My friend said that there are differences between "mod" and "remainder".

If so, what are those differences in C and C++? Does '%' mean either "mod" or "rem" in C?

Answer*

Draft saved
Draft discarded
Cancel
1
  • ((n%m)+m)%m weaknesses: it is undefined behavior (UB) when the the addition overflows (large m) and also UB in the corner case of n==INT_MIN, m = -1. Commented May 17, 2025 at 22:42

lang-c

AltStyle によって変換されたページ (->オリジナル) /