ECE 220 Lecture Notes - Lecture 17: Enumerated Type

34 views2 pages

Document Summary

/* how to make a 2x2 matrix inline in lc-3 (because struct elements. By default, the first element is 0, and each further element is 1 larger you can define a value for a label with = value. Can"t exceed int_max enum labels are not lvalues, can"t take address of a label enum declarations look like enum (name) { label1 [ = val], label2, } Variables of enumerated type are defined as enum (typenae) varname. Allows you to bundle together various (possible diverse) elements within one stored contiguously elements are accessed using . if you have a pointer, can also access elements using -> (or (*ptr). ) Basic types * int, char int, char double, float. Define a new type using an old type typedef (old type name) newtypename. /* out = a*b */ int matrix_multiply(struc matrix *out, struct matrix *a, struct matrix *b) { // check if its compatible if ((*a). cols != b -> rows) return 0;

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