COMP 206 Lecture Notes - Lecture 24: C Dynamic Memory Allocation, Memory Management, Global Variable

74 views2 pages

Document Summary

Has no concept of object programming or classes, but we can use structs, dynamic memory, and function pointers together to create a functionality similar to object programming. We can define debug functions that have any number of arguments. Takes the pla(cid:272)e of (cid:858)(cid:272)lass(cid:859) i(cid:374) other progra(cid:373)(cid:373)i(cid:374)g la(cid:374)guages. A struct is a group of fields of a certain type (you can build structs of structs or structs of type int, char, etc. ) Can define single variables, arrays, and pointers to structs. Using a struct: to use a struct, you must create a variable. Note that a here is a global variable of struct type abc. You can use typedef to define a new type identifier typedef struct course int numstudents; char name_prof[100]; char location_building[100]; int location_room; Mycourse is the new type identifier; now when identifying a new struct variable, i use mycourse instead of struct course. Mycourse cs206; cs206 is the variable in this case.

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