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?

  1. A.

    ONE TWO TWO ONE

  2. B.

    TWO ONE ONE TWO

  3. C.

    ONE TWO ONE TWO

  4. D.

    TWO ONE TWO ONE

Attempted by 403 students.

Sign up free to check your answer

Sign up free

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…