diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-11-08 09:29:26 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-11-08 09:29:26 +0100 |
commit | c639ff7dba5230482716321519d29e3610fd716f (patch) | |
tree | e3ca8f6ee402aaa6020864d220f17037e2b1bf7c /C | |
parent | mån 7 nov 2022 18:02:29 CET (diff) | |
download | wiki-public-c639ff7dba5230482716321519d29e3610fd716f.tar.gz wiki-public-c639ff7dba5230482716321519d29e3610fd716f.tar.xz |
tis 8 nov 2022 09:29:26 CET
Diffstat (limited to '')
-rw-r--r-- | C.wiki | 2 | ||||
-rw-r--r-- | C/Named Arguments.wiki | 13 |
2 files changed, 15 insertions, 0 deletions
@@ -4,6 +4,8 @@ innehåller printf-strängar för `<stdint.h>`. +- [[C/Named Arguments]] + == Universal character specifier == TODO dubbelkolla namnet diff --git a/C/Named Arguments.wiki b/C/Named Arguments.wiki new file mode 100644 index 0000000..7e673f2 --- /dev/null +++ b/C/Named Arguments.wiki @@ -0,0 +1,13 @@ +https://www.reddit.com/r/C_Programming/comments/yjbe62/combining_default_named_and_positional_arguments/ + +{{{c +struct fooParam { int x, y; }; +#define foo(...) foo((struct fooParam) {__VA_ARGS__ }) +int (foo)(struct fooParam p) { + return p.x + p.y; +} + +int main() { + printf("%d\n", foo(.y = 20, .x = 10)); +} +}}} |