How to create a Singleton in C?

前端 未结 6 1194
感动是毒
感动是毒 2020-12-08 01:11

What\'s the best way to create a singleton in C? A concurrent solution would be nice.

I am aware that C isn\'t the first language you would use for a singleton.

6条回答
  •  温柔的废话
    2020-12-08 01:34

    You don't need to. C already has global variables, so you don't need a work-around to simulate them.

提交回复
热议问题