1/6
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Can arrays in C++ store multiple types?
No, they can only store a single type.
How can we initialize all the values in the following array to 11, 12, 13, 14, 15?int foo[5];
int foo[5] = {11, 12, 13, 14, 15};
How can we partially initialize the values in this array to 11, 12, 13?
int foo[5];
int foo[5] = {11, 12, 13};
When we partially initialize an array, what happens to the other elements?
int foo[5] = {11, 12, 13};
All of the other elements are automatically initialized to 0 by C++.
How can we initialize every element in this array to 0 without writing the zeroes explicitly?
int foo[5];
int foo[5] = {};
What happens in the following array, where we didn’t mention a size?
int foo[5] = {11, 12, 13, 14, 15};
This contains no size, so the compiler just realizes that there are 5 values, and behind the scenes, it automatically creates int foo[5];
Ended on Slide 7, Week 2 special members (you can kind of skip this whole chapter and be fine, because it’s identical to other languages).