Skip to content

Instantly share code, notes, and snippets.

@reddragon
Last active September 12, 2017 18:30
Embed
What would you like to do?
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