Consider the 𝐶/𝐶++ function 𝑓() given below: void f(char w[]) { int…
UGC NET 2018
Consider the 𝐶/𝐶++ function 𝑓() given below:
void f(char w[])
{
int x=strlen(w); //length of a string
char c;
for (int i=0; i<x; i++)
{
c=w[i];
w[i]=w[x-i-1];
w[x-i-1] =c;
}
}
Which of the following is the purpose of 𝑓() ?
- A.
It outputs the contents of the array in reverse order
- B.
It outputs the contents of the array in the original order
- C.
It outputs the contents of the array with the characters shifted over by one position
- D.
It outputs the contents of the array with the characters rearranged so they are no longer recognized as the words in the original phrase
Attempted by 163 students.
Sign up free to check your answer
Sign up freeLoading lesson…

