Skip to main content
Logo image

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";