What is the output printed by the following C code?
# include <stdio.h> int main ()
{ char a [6] = "world" ;
int i, j;
for (i = 0, j = 5; i < j; a [i++] = a [j--]);
printf ( "%s\n" , a);
} /* Add code here. Remove these lines if not writing code */ |
(A) dlrow
(B) Null String
(C) dlrld
(D) worow
Answer: (B)
Explanation: As at the base address or starting of the string “Null” is placed, so while reading array if Null comes it assumes that this is the end of array, so it terminates here only.
Quiz of this Question