Skip to content

Instantly share code, notes, and snippets.

@reddragon
Last active September 12, 2017 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reddragon/366a3b22acfd2c889b7d3e0cc6c79757 to your computer and use it in GitHub Desktop.
Save reddragon/366a3b22acfd2c889b7d3e0cc6c79757 to your computer and use it in GitHub Desktop.
Set struct members inline
#include <iostream>
using namespace std;
struct Foo {
int a;
double b;
};
int main() {
const Foo f = {
.a = 3,
.b = 5
};
cout << f.a << " " << f.b << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment