What is the difference between a static and const variable?

前端 未结 17 1760
天命终不由人
天命终不由人 2020-11-29 18:39

Can someone explain the difference between a static and const variable?

17条回答
  •  一整个雨季
    2020-11-29 18:56

    Simple and short answer is memory is allocated for static and const only once. But in const that is for only one value where as in static values may change but the memory area remains the same until the end of the program.

提交回复
热议问题