C : is there “lazy evaluation” when using && operator, as in C++?

前端 未结 4 1555
后悔当初
后悔当初 2020-12-03 21:20

I would like to know if this looks correct :

while((next !=NULL) && (strcmp(next->name, some_string) < 0) {
    //some process
}
4条回答
  •  清歌不尽
    2020-12-03 21:48

    Yes, in C++ short circuit and and or operators are available.

    Here's a question answered in the C-faq on the subject.

提交回复
热议问题