117x Filetype PDF File size 0.10 MB Source: www.lamsade.dauphine.fr
C++ Programming Structures, Classes, Linked Lists M1 Math Michail Lampis michail.lampis@dauphine.fr Structures ● Structures are a general way to store more complicated objects in C/C++ ● General syntax: struct generalName { declare member1; declare member2;... }; struct generalName obj1, obj2; An example ● C does not have a type for complex numbers ● Recall: a complex number is z = a + ib struct complex { double a; double b; }; struct complex z1,z2; Struct = a new type ● The idea here is that when we define a structure we define a new type of object ● Hence, we can define variables that have this type ● At declaration, enough memory is allocated to store all member properties of the structure object
no reviews yet
Please Login to review.