+ 1

Is ZERO an integer?

21st Dec 2021, 10:24 AM
Pavithra Ilankoon
Pavithra Ilankoon - avatar
2 ответов
+ 3
Sure! There is no problem to initialize a variable like this: int variable = 0; Don't make confusions between 0 (zero) and NULL, or '\0' (these are in C) or nil (Swift) and many more. But the conclusion is that zero is an integer. In programming there are some discussions on -0 and +0. Just read about the one's and two's complement in programming.
21st Dec 2021, 10:27 AM
Romeo Cojocaru
Romeo Cojocaru - avatar
+ 1
Let me first clarify that we (that is mathematicians or mathematics enthusiast) generally think of integers as all "whole numbers" ranging from "negative infinity" to "positive infinity". At least this is the intuitive picture. In this setting, saying that zero is not an integer seems to somehow destroy that intuitive picture. Further, there exists the concept of positive integers, which are all "whole numbers" strictly greater than zero. Surely, I would argue that mathematician would try their best to eliminate redundancies within definitions. Thus, if zero were not considered an integer, instead of positive integers, we would simply say non-negative integers. So, if we are talking of integers in that sense, then Yes, most of us consider zero an integer. But, maybe you meant what we call natural numbers. Then there is in fact no binary answer since different mathematician have different opinions about if zero should be considered a natural number or not. Sorry for the lengthy digression :).
4th Jan 2022, 8:43 AM
Giuseppe T
Giuseppe T - avatar