Professional Documents
Culture Documents
CO1401 Week 13 Lecture
CO1401 Week 13 Lecture
CO1401 Week 13 Lecture
Programming
Week 13
Some useful syntax
Enumerated data types
• Be careful.
• auto just saves typing time.
• It has no effect on the speed of your program.
• Use it when the type of a variable “is hard to know
exactly or hard to write” (Stroustrup)
• Do not use it by default. If an object has a type such
as an integer then use the data type!
• Because auto is completed by the compiler at compile
time you do not always know what data type has been
created, and this can cause problems.
Ranged-based for loop
● The new style array is what is known as a wrapper. A wrapper "wraps around" another piece of code.
● The wrapper manages the code. It hides it away inside a shell. It looks after the code in a nice clean fashion.
● The new style array wraps around old style array. An array exists inside, but you get to use the wrapper. What it gives you is an array with a lot of useful additions.
C11 array