+ 1

What is the difference between const and static in c++?

c++

20th Jan 2018, 6:27 PM
Amit Pokhrel
2 Answers
+ 3
you can have multiple static variables in different c++ source code files with the same name and no name conflicts.const is just constant, meaning can't be modified. A static variable can get an initial value only one time. ... As such, static variables are only initialized once. -stackoverflow
20th Jan 2018, 6:35 PM
emmey
emmey - avatar