Exercise · Variables and Types · lesson 9 of 9
Exercise: call counter
Write the function int next_id(): each call returns the next number in order, starting from 1.
- first call
next_id()→1 - second call
next_id()→2 - third call
next_id()→3
Constraints: the checks call next_id() four times in a row, and the program makes no other calls.
Do not add extra #include lines unless the task says so explicitly.
Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.