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

asked in Programming by Junior (637 points) | 32 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 Loyal (5.5k 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
49,540 questions
54,099 answers
187,269 comments
71,006 users