1

In languages like C#, you can do:

    MyObject myObject = new MyObject() {property1 = 1, property2 = 2 ...}

Is it possible to do this for a struct in C rather than writing assignments one per line? If I try this in C, I get error: 'property1' undeclared (first use in this function); did you mean 'constructorArg1'?

This seems basic, just don't know what to google.

Luke Vanzweden
  • 466
  • 3
  • 15
  • In C99 you have designated initializers, but I don't know enough about C# to say that they are the same thing. – Neil Mar 05 '22 at 03:39

0 Answers0