You will need to use new to highlight any reference type (class).
Any type of value (such as int or structs) can be declared without new. However, you can still use new ones. The following are valid:
int i = new int();
Note that you cannot directly access a value type before initializing it. The value of the new TheStructType() often used with the structure, since it allows you to fully use the elements of the structure without explicitly initializing each element. This is because the constructor is initializing. With a value type, the default constructor always initializes all values โโto 0.
In addition, with struct, you can use new with a constructor other than the standard, for example:
MyStruct val = new MyStruct(32, 42);
This allows you to initialize the values โโwithin the structure. However, it is not required here, only an option.
source share