EECS 280 Lecture 6: Compound Objects

34 views3 pages
30 Sep 2018
School
Course
Professor

Document Summary

A compound type is a type that can glue together several other types into a new type. An array is a sequence of objects of the same type. We"re going to use structs to represent heterogeneous compounds. Double a,b,c,; // edge lengths of a triangle. We can initialize member variables on at a time using a dot operator or an initializer list. You can also assign a struct to one another; you can make a copy. We can also pass structs as function arguments. However, they should be passed by reference or with a pointer. Const means "do not modify in this scope". When you use const with a pointer, there"s two object: the pointer itself and the object pointed to. Const char *s; // s is a pointer to a character that i"m not allowed to change. Char *const s; // you can change what the pointer points to but not the address.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents