Тест · Переменные и типы · урок 9 из 10
Тест — static внутри функции
Что выведет программа?
#include <iostream>
int add(int x) {
static int total = 0;
total = total + x;
return total;
}
int main() {
int total = add(5);
std::cout << add(2) << ' ' << total << '\n';
}