99.9k views
3 votes
If the variable letter has been defined as a char variable, which of the following are not valid assignment statements to assign letter w to the variable?

A) letter = w;
B) letter = 'w';

C) letter = "w";

1 Answer

4 votes

Answer:

The correct answer for the given question is option(A) and option(C) .

Step-by-step explanation:

To declared any variable of character we using following syntax

char variable=' value';

char letter='w';

In option(A) their is no single quotes between character w .So this is not a valid assignment.

In option(C) their is double quotes between character w,no single quotes between character w .So this is not a valid assignment.

In option(B) their is single quotes between character w .So this is a valid assignment.

So option(A) and option(C) are are not valid assignment statement.

User Ndmeiri
by
5.4k points