Is using goto a legitimate way to break out of two loops?

前端 未结 6 867
悲哀的现实
悲哀的现实 2021-01-01 16:05

I am solving problem 9 on the Project Euler. In my solution I use a "goto" statement to break out of two for loops. The Problem is the following:

6条回答
  •  灰色年华
    2021-01-01 16:33

    return is a "structured" goto which many programmers find more acceptable! So:

    static int findit(int sum, int* pa, int* pb, int* pc)
    {
        for (int a = 1; a

提交回复
热议问题