For loop polling

How many times will the following loop execute? for(j = 1; j <= 10; j = j-1)

  • a. Forever

    Votes: 1 100.0%
  • b. Never

    Votes: 0 0.0%
  • c. 1

    Votes: 0 0.0%
  • d. 0

    Votes: 0 0.0%

  • Total voters
    1

reddensoft

Banned-Spam
Joined
Oct 7, 2022
Messages
84
Reaction score
9
How many times will the following loop execute?

for
(j = 1; j <= 10; j = j-1)
 
It depends. What's the type of `j`?

For example, if `j` is an unsigned int, this will only execute twice. If `j` is a signed int, this will execute forever.
 
Back
Top