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); // First output

    f2(&a, &b); 
    printf("%s %s", a, b); // Second output

    return 0;
}

What will be the output of the above code?

1
ONE TWO TWO ONE
2
TWO ONE ONE TWO
3
ONE TWO ONE TWO
4
TWO ONE TWO ONE

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation