Consider the following C function definition. int fX(char *a){ char *b = a;…

GATE · 2024 · CS · Set 2 · Computer Science & IT

Consider the following C function definition.

                int fX(char *a){

                    char *b = a;

                    while(*b)

                        b++;

                    return b - a;

                }

Which of the following statements is/are TRUE?

  1. A.

    The function call fX(”abcd”) will always return a value

  2. B.

    Assuming a character array c is declared as char c[] = ”abcd” in main(), the function call fX(c) will always return a value

  3. C.

    The code of the function will not compile

  4. D.

    Assuming a character pointer c is declared as char *c = ”abcd” in main(), the function call fX(c) will always return a value

Attempted by 144 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…