how many times will strlen() be called in this for loop?

后端 未结 6 726
渐次进展
渐次进展 2020-12-03 14:46

Will the strlen() function below get called just once (with the value stored for further comparisons); or is it going to be called every time the comparison is performed?

6条回答
  •  误落风尘
    2020-12-03 15:11

    strlen checks the lenght of the provided string. Which means that if the lenght is 10. Your iteration will keep on going as long as i is below 10.

    And in that case. 10 times.

    Read more about loops

提交回复
热议问题