Computer/C++

file2.cpp - 정적 변수

Basha 2023. 2. 15. 22:21
728x90
// file2.cpp

#include "file2.h" // file2 헤더파일 포함

// 아무것도 없음

// file2.h
static int b = 10; // 정적 변수 : 프로그램 시작과 함께 생성되어 프로그램 종료와 함께 소멸됨.
static int h() {  return ++b; }
728x90
반응형