Last active
September 12, 2017 18:30
-
-
Save reddragon/366a3b22acfd2c889b7d3e0cc6c79757 to your computer and use it in GitHub Desktop.
Set struct members inline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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