The following if (a[p] = -1) will execute this assignment statement. The code idea is really strange and the idea is a bit confusing The middle a[1] = 2, a[2] = 3 , a[4] = 5, a[6] = 7, a[10] = 11, a[12] = 13; Don’t you find this paragraph uncomfortable... int mainvoid main This is a conclusion It's a problem, void is wrong, LLVM will even report this error, there is no need to use the void main method The idea is a bit confusing, it is recommended to rewrite it
To add, the continue statement should be used as little or as little as possible, as it can easily lead to code that is difficult to understand
There are many problems in the code provided by the questioner, and modification is more troublesome than rewriting. It is recommended to refer to the Sieve of Eratosthenes algorithm to rewrite one (the animation in the link is very easy to understand).
The idea of this code is simply unconstrained. If you can't even tell that the subscript is out of bounds and if (a[p] = -1), you might as well leave the school girl to me. It is recommended to rewrite it directly without changing it.
The following if (a[p] = -1) will execute this assignment statement. The code idea is really strange and the idea is a bit confusing
The middle a[1] = 2, a[2] = 3 , a[4] = 5, a[6] = 7, a[10] = 11, a[12] = 13; Don’t you find this paragraph uncomfortable...
int mainvoid main This is a conclusion It's a problem, void is wrong, LLVM will even report this error, there is no need to use the void main method
The idea is a bit confusing, it is recommended to rewrite it
To add, the continue statement should be used as little or as little as possible, as it can easily lead to code that is difficult to understand
There are many problems in the code provided by the questioner, and modification is more troublesome than rewriting. It is recommended to refer to the Sieve of Eratosthenes algorithm to rewrite one (the animation in the link is very easy to understand).
The idea of this code is simply unconstrained. If you can't even tell that the subscript is out of bounds and if (a[p] = -1), you might as well leave the school girl to me. It is recommended to rewrite it directly without changing it.