how to give a struct default value? - GameDev.net // All elements have default values of 0: TemperatureRange[] lastMonth = new TemperatureRange[30]; Alle Memberfelder einer Struktur müssen definitiv zugewiesen … Now, you get all of the default values. All a struct's member fields must be definitely assigned when it's created because struct types directly store their data. Return a Struct From Function in C Default constructors are called during default initializations and value initializations. This is called a memberwise initializer. Default constructors - cppreference.com The default value of a struct corresponds to the value returned by the default constructor of the struct . What you can do is give it a constructor: struct mystruct For first number, Enter real part: 1.1 Enter imaginary part: -2.4 For second number, Enter real part: 3.4 Enter imaginary part: -3.2 result.real = 4.5 result.imag = -5.6. Swift Structs Default values for struct The default value of a struct corresponds to the value returned by the default constructor of the struct (Default constructors). Default initialization - cppreference.com