Skip to main content
Contents Index
Dark Mode 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 20.2 Assign a New Value
Just like the variables we have previously worked with, strings can also be updated after they are initialized.
Activity 20.2 .
Can you assign a new string value to
firstName
in the code? For example, can you use the following line?
firstName = "Alex";
admin ..... open in new window
Please paste your text submission into the box below, then select Run
to submit it:
Investigate 20.3 .
We declare strings as arrays of type
char , so is it possible to include numbers within these strings? For example, could we declare the following string?
char firstName[] = "Simon1234";