Skip to main content
Contents Index
Search Book
Search Results:
No results.
Readability settings Prev Up Next
\(\newcommand{\N}{\mathbb N}
\newcommand{\Z}{\mathbb Z}
\newcommand{\Q}{\mathbb Q}
\newcommand{\R}{\mathbb R}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 17.4 Practice: Initializing Arrays
Check Your Understanding Check Your Understanding
1.
Which of the following is correct?
int num[] = {1, 2, 3, 4, 5};
Correct
int num = {1, 2, 3, 4, 5};
Not quite. Try again!
num[4] = int{1,2, 3, 4, 5};
Not quite. Try again!
Not quite. Try again!
2.
Please declare and initialize an array of five integers and store the values 2, 7, 4, 9, -5 in the array (in this order). You should name your array "arr" and not modify any of the code to print out the array’s contents. Be sure to declare any additional variables needed.
admin ..... open in new window
When your program performs correctly you’ll be given a keyword to enter in Canvas.