The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
30 views

asked in Programming by Junior (979 points) | 30 views

1 Answer

0 votes
Since i is static , it is already initialized as 0;

for(++i // initialization only once ; ++i//termination condition ; ++i//This will execute later)

So in the 1st print - 2 will be printed.

And in the 2nd print - 4 will be printed.

Thus output is 2 4
answered by Active (4.7k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
48,564 questions
52,765 answers
183,387 comments
68,245 users