How do you fix the unbounded string copy in the following code? char fname[20]; /* 1 / cout << “Enter First Name:”; / 2 / cin >> fname ; / 3 */

  1. Replace cin call in line 3 with gets() function

  2. The length of input from cin cannot be limited. Use a larger array for fname

  3. Use cin.width[20] before line 3

  4. Use cin.size[19] before line 3


Correct Option: C

Find more quizzes: