Answer the question
In order to leave comments, you need to log in
How to write normally: for (int i = 0; ...) or for (int i = NULL; ...)?
How will it normally write 0 or NULL in expressions like int i = 0 ?
Answer the question
In order to leave comments, you need to log in
NULL is a service define, which is, in particular, in Windows.
The common practice is int i = 0; At least because it's shorter.
The problem is different. In int.
In most languages, an int is 32 signed bits, that is, two gigabytes. In modern memory systems, there are tens-hundreds-thousands of gigabytes, and programs process various kinds of big data and ML. So indexing an array with ints can easily lead to subtle bugs.
Therefore, it is correct to write for(size_t i = 0; ..
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question