Struct Variable Assignments

A variable of a particular struct type can be copied to another variable of the same struct type.

tUSAddress myShippingAddress

tUSAddress myBillingAddress

...

 

Move myShippingAddress to myBillingAddress

The above copies the variable myShippingAddress to the myBillingAddress variable using a deep memberwise copy operation. Each member in turn of the struct type is copied from the myShippingAddress variable to the myBillingAddress variable. The above code is functionally equavalent to the following…

Move myShippingAddress.sStreet  to myBillingAddress.sStreet  

Move myShippingAddress.sCity    to myBillingAddress.sCity    

Move myShippingAddress.sState   to myBillingAddress.sState   

Move myShippingAddress.iZipCode to myBillingAddress.iZipCode

Struct variable assignments of different struct types, as well as struct variable assignments to/from a non-struct type, are illegal and will result in a run-time error.