Ask Question

If chr is a character variable, which of the following if statements is written correctly? A. if (chr = "a") B. if (chr = = "a") C. if (chr = 'a') D. if (chr = = 'a')

+2
Answers (1)
  1. 1 June, 22:45
    0
    D. if (chr=='a')

    Explanation:

    Since chr is a character variable means it can only store a single character it could be any character. Characters are written in c+ + language using single quotes out of the other three statements two of them uses double quotes and the third uses assignment operator instead equal to operator. Double quotes are used for null terminated strings.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “If chr is a character variable, which of the following if statements is written correctly? A. if (chr = "a") B. if (chr = = "a") C. if (chr ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers