In C++ this code is valid
struct foo{ int x; }; int bar(foo f); bar({1});
However I get an error when I try to do something similar in C. Is there way a to pass a struct to a function without actually creating a variable for it?
You need a compound literal for this:
bar((struct foo){1});