44.6k views
4 votes
Declare two variables of type char. assign the letter a to the first char variable named letter1 and t to the second variable named letter2.

User Mmix
by
7.9k points

1 Answer

7 votes
Variable is a named location where a value is stored. There are different types of variable, such as there are different types of values (integer, character, etc.).
To create an integer variable, the syntax is
int "name of the variable"
To create a char variable, the syntax is:
char "name of the variable"
In our case the variables are letter1 and letter2 and the values that belong to them are a and t , respectively.
So, the syntax is:
char letter1;
char letter2;
And the assignment statements are:
letter1='a';
letter2='t';