Multiple choice

To receive the string “we are going” in an array char str[100], which of the following functions would you use?

  1. scanf(“%s”,str);

  2. gets(str);

  3. getche(str);

  4. fgetchar(str);

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

gets() is the appropriate function to read a string containing spaces from the keyboard into a character array.