C Programming MCQ

1:

If S is an array of 80 characters, then the value assigned to S through the statement scanf("%s",S) with input 12345 would be

A.

"12345"

B.

nothing since 12345 is an integer

C.

S is an illegal name for string

D.

%s cannot be used for reading in values of S

 

Answer : A

Explanation :

scanf("%s", S) only scans first parameter of input stream .So Option A  is correct.

ateeb said: (10:49pm on Friday 9th February 2018)
S is an array and it should be taking input in some loop. or scanf("%s",s[index number])
SANKHA NATH SEN said: (1:02pm on Sunday 18th February 2018)
Options are incorrectscanf("%s", S); only scans first parameter of input stream 1 2 3 4 5 and it's 1.Option A could have been correct if the input was 12345 instead of 1 2 3 4 5.

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.