![]() Polygon rendering // this 3d rendering better not have more than 30,000 polygons! Record record // let's hope there are less than 500 records! If we have to declare the size of everything at compile time, the best we can do is try to make a guess the maximum size of variables we’ll need and hope that’s enough: char name // let's hope their name is less than 25 chars! Or we may be creating a game, with a variable number of monsters (that changes over time as some monsters die and new ones are spawned) trying to kill the player. Or we may want to read in a number of records from disk, but we don’t know in advance how many records there are. However, you will come across situations where one or both of these constraints cause problems, usually when dealing with external (user or file) input.įor example, we may want to use a string to hold someone’s name, but we do not know how long their name is until they enter it. Memory allocation and deallocation happens automatically (when the variable is instantiated / destroyed). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |