Complex Types
§Complex Type
§ Structure
§ struc Name {string First; string Last};
§ Name Jon, New; Jon.First=“Jon”; Jon.Last=“Melvin”; Name NewName;
§
§
§ Array (subscripts are always surrounded with […]; subscripts go from 0, …)
§ int[] Integers=new Int[32]; /* declare array Integers of 32 integers */
§ /* create and initialize array of 3 string answers */
§ string[] Answers=new  string[] {“Yes”,”No”,”Maybe”}
§ /* this fails; only constant length arrays allowed; Answer[0]=“Yes” */
§ int a=5; int[] Array=new int[a];
§ /* 2 dimensional arrays */
§ string[][] Names=new string[2][];
§ Names[0]=new string[]{"James","Joyce"};
§ Names[1]=new string[3]{"E","B","White"}; /* Name[1,2]=‘White’ */
§ Fields of given type are objects.  Some methods are of object instance, some of base
§   class.  E.g., int i=5; string s=i.ToString; int[] Test int[](1,3,2);  Array.Reverse(Test)
§   changes order of elements to 2,3,1.
§ Array.Sort(Test) changes order to 1,2,3.
§
§