static 키워드
static 키워드
전역변수(extern 키워드)
// ExternTest.h
extern int globalValue;
void IncreaseValue();
// ExternTest.c
#include "ExternTest.h"
int globalValue = 2;
void IncreaseValue()
{
globalValue++;
}
// Main.c
#include "ExternTest.h" // 해당 파일을 COPY
int main()
{
printf("%d", globalValue);
}C 스타일 static
파일 속 정적 변수
함수 속 정적 변수

C++ 스타일 static
정적 멤버 변수

정적 멤버 변수 BEST PRACTICE
정적 멤버 함수

Last updated