Ask Question
2 December, 17:55

The following program declares an array of char named as myString There are 6 following cases (a, b, c, d, e, f) to access myString. Which cases are valid access? If there are any invalid cases, how to correct them? #include using namespace std; int main () { char myString[16]; / /a. strcpy_s (myString, "Hello the world"); / /b. cout << strlen (myString); / /c. myString = "Mary Lane"; / /d. cin. getline (myString, 80); / /e. cout << myString; / /f. myString[6] = 't'; return 0;

+3
Answers (1)
  1. 2 December, 20:21
    0
    See explaination

    Explanation:

    a.

    myString is "Hello the world"

    b.

    prints "15"

    c.

    This is invalid.

    We have to use strcpy_s to copy strings

    FIX:

    strcpy_s (s,"Marylane");

    d.

    reading string upto length 80 from the user and stored it in myString variable

    e.

    prints the string enetered by user to console

    f.

    replacing 7th character by 't'
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “The following program declares an array of char named as myString There are 6 following cases (a, b, c, d, e, f) to access myString. Which ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers