Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
when I browse one demo project and saw this declaration in a header file:
static const int x;


not quite sure the meaning of it. so post here to check gurus here.

const int x; ==> x is a constant and can not be changed.

defined in the top of a header file, this static variable means it is a global variable and can be accessed/updated anywhere.

do I miss anything here?

What I have tried:

I understand the meaning of these declaration, but not sure what is the benefit of doing this way.
Posted
Updated 25-Oct-21 7:17am

 
Share this answer
 
Comments
Southmountain 24-Oct-21 11:09am    
thank you!
thank you for this great link! after study these notes I gained deeper understanding of this keyword: static.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900