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

+1
Answers (1)
  1. 24 March, 11:48
    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 & 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