In a “for” statement, should I use `!=` or `<`?

后端 未结 8 971
悲&欢浪女
悲&欢浪女 2021-02-02 05:39

I\'ve seen both of these two for statements:

for(i=0;i<10;i++) 

for(i=0;i!=10;i++)

I know they all stop when i reaches 10 , bu

8条回答
  •  你的背包
    2021-02-02 06:16

    My everyday practice is to use < when I iterate cycle with simple types such as integers and to use != when I work with stl-kind iterators

提交回复
热议问题