Consider the following code: #include <stdio.h> void f1(char *x, char *y) {…
PYQ UGC NET 2024
Consider the following code:
#include <stdio.h>
void f1(char *x, char *y)
{
char *t1; t1=x; x=y; y=t1;
}
void f2(char **x, char **y)
{
char *t1; t1=*x; *x=*y; *y=t1;
}
int main()
{
char *a = "ONE", *b = "TWO";
f1(a, b); printf("%s %s", a, b);
f2(&a, &b); printf("%s %s", a, b);
return 0;
}What will be the output of the above code?
- A.
ONE TWO TWO ONE
- B.
TWO ONE ONE TWO
- C.
ONE TWO ONE TWO
- D.
TWO ONE TWO ONE
Attempted by 403 students.
Sign up free to check your answer
Sign up freeLoading lesson…

