Skip to content

Instantly share code, notes, and snippets.

@kballenegger
Created March 3, 2014 23:15
Show Gist options
  • Select an option

  • Save kballenegger/9336682 to your computer and use it in GitHub Desktop.

Select an option

Save kballenegger/9336682 to your computer and use it in GitHub Desktop.
char *const kCBLocationAtStartupString = "startup";
// etc ...
typedef enum CBLocation {
CBLocationAtStartup = (char *const)"startup",
// etc.
} CBLocation;
void showInterstitial(CBLocation location) {
char *locationString = (char *)location;
printf("%s\n", locationString);
}
@rmartinjak
Copy link

Try this:

enum CBLocation {
   CB_STARTUP,
   CB_FOO,
   // ...
};

const char *CBLocationStrings[] = {
    [CB_STARTUP] = "startup",
    [CB_FOO] = "foo",
    // ...
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment