Teaching UGC NET Mock Test Series 2025 (Paper 1 & 2) Programming and Data Structure Programming in C While Loop
Consider the C/C++ function f() 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 f()?1
It output the content of the array with the characters rearranged so they are no longer recognized a the words in the original phrase.
2
It output the contents of the array with the characters shifted over by one position.
3
It outputs the contents of the array in the original order.
4
It outputs the contents of the array in the reverse order.