Step 5

Step 5 includes the theory of chapter 9: More Datatypes and Operators (pages 181-214) and chapter 10: Structures and Unions (p. 215-243). The emphasis in this step is on dynamic memory allocation with the operators new and delete (ie, allocating memory during program execution, as opposed to “static allocation” at compile time). You will also gain a deeper knowledge about managing structures, especially using the arrow operator.

Study

Sid. 181-184 – important here is to understand the meaning and importance of a const-declaration, while the volatile section (184-185) can be overlooked.
Sid. 185-190 concern storage classes, where static and extern are important concepts which you must understand and be able to use. Pages 191-193 (register) are read only as overview.
Sid. 193-197 is about type handling with enum och typedef, about which you should have knowledge. Among the new operators which are introduced, the sections on bitwise operators (197-203) are optional to study. You can read it of your own interest or return to the section later if necessary.
Sid. 203-207 present some additional interesting operators that you should know about.
Sid. 207-214 about dynamic memory allocation are the most important sections of this chapter, which you must read and understand thoroughly.
Sid. 216-234 provides in-depth knowledge about structures (the first pages were introduced during step 3). It is especially important that you understand the use of the arrow operator introduced here. The remaining sections about bit fields and unions are then optional reading.

Objectives

After Step 5, you should be able to adapt your data- and memory-management in a more flexible and user-friendly manner. You will especially be able to use dynamic allocation of memory for different data types. You will have a deeper understanding of the computer’s memory model, and the different ways you  can affect access and scope of the data in your programs, using storage classes and several new operators. You should also be familiar with a number of new ways for type handling as to define or modify your own types/type names using eg struct, typedef and enum.

An important objective is to continue to deepen your knowledge of functions and different types of parameter passing. Components from the previous steps should by now be well consolidated.

Practical applications

The step has 13 laboratory assignments, among which you make appropriate choices to achieve 6 points (minimum). Note that assignment 1 is mandatory.

Welcome to CoursePress

en utav Linnéuniversitets lärplattformar. Som inloggad student kan du kommunicera, hålla koll på dina kurser och mycket mer. Du som är gäst kan nå de flesta kurser och dess innehåll utan att logga in.

Läs mer lärplattformar vid Linnéuniversitetet

Student account

To log in you need a student account at Linnaeus University.

Read more about collecting your account

Log in LNU