Ask Question
7 October, 20:36

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. 8 October, 00:07
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers