Q:

How to determine if the current program is being used as a library or a stand-alone executable?

I want to make a simple C program that outputs three values, I need the program to output the values ONLY IF the current program is being directly executed and NOT included.
Here is my code:
#define Type "type-of-something"
#define Info "some-basic-info"
#define Todo "something-todo"

To determine whether or not the current script is being imported or directly executed in Python you can do the following:
if __name__ == "__main__":
    pass

I haven't the slightest clue as to how to do this in C but I'm thinking something like this:
#include <stdio.h>
void main(void) {
  if(__name__ == "__main__") {
    printf("%d\n", valueX);
  }
  return;
}

Is something like that possible in C?
If so what is the most efficient way I can go about doing this?

A:

I'd go for something like this, if you want it simple stupid:
#include <stdbool.h>

bool as_library = true;

int main(int argc, char ** argv) {
  as_library = false;
  // ...
  return 0;
}

Since when you're code is compiled and used as program, that main will be called, then that boolean will be set accordingly.

