Perhaps this is a dumb question and the answer is just "use a global", but I'm wondering how the concept of a singleton is usually done in C. For example, let's say I have a group of proxies that will never change during the execution of the program, but every function/thread/whatever needs access to it. I was thinking doing something like this:
typedef struct proxy {
int fails;
char http[50];
char https[50];
} Proxy;
Proxy PROXIES[] = {
{.fails=0, .http="http://...", .https="https://..."},
{.fails=-1}; // use sentinel for sizeof?
};
Does the above seem like a valid way to do this? If not, what are some ways this is done in C?