ECS 30 Lecture Notes - Lecture 10: Linked List

19 views2 pages
5/30/2018 lecture
Structures
Basic example
- Struct creates new data type
o Collection of one or variables
o Possibly of different types
o Grouped together under unified name
- Ideal to describe complex objects
o Group related variables as a unit
- Access to structure members with “.”
o Highest precedence
Initialization
- Initialization with ordered list of initializers
- Copy by copy
- By function
o No conflict in names
o Returns byte copy of object
Multi-level structure
Function (by copy)
*c.dir it will fail
The .” has high priority C will think its an address
Parenthesis around *c
- (*c).dir this will work
- Only addresses of structure is passed
- Much better for memory footprint and performance
- Another option: Use arrow operator
(*c).deg
- first dereference pointer to get the object
- Second, access to member
- Otherwise it wont work
Reference:
- Lng
- Lng.deg
p_lng
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents