CS 1337 Lecture Notes - Lecture 6: Semicolon

8 views3 pages

Document Summary

}; //semi-colon required int studentid; string name; float gpa; // description : hello world in c++, ansi-style. #include using namespace std; struct student void printclass(const responsibilityclass &aclass); Instructor whoistheteacher(); int main() { struct responsibilityclass string meetingtime; string classroom; //member access operator cout << me. studentid << endl; int scores[100]; responsibilityclass spring2018; //are variables that are a type of some structure. //we have to copy the members and this can be a lot of bytes. //also could pass by reference to avoid this inefficiency (use &) //introduces new problem because now the function can change the value of the spring2018. teach. name = brandenburg; //first access teach in. //like any other variable, a variable that is a structure has a location in. Instructor *instptr; instptr = &a; //contains address of a, an instructor variable. //we need to dereference the pointer to get the actual structure, then use the. //member access operator has higher precedence than indirection operator.

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