GATE 2024 set2 · CS · MSQ · 1 mark · Programming and Data Structures › C Programming Fundamentals
GATE 2024 set2 Computer Science and Information Technology question: Consider the following C function definition. code Which of the following statements…
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?
- (A)
The function call fX("abcd") will always return a value
- (B)
Assuming a character array c is declared as char c[] = "abcd" in main(), the function call fX(c) will always return a value
- (C)
The code of the function will not compile
- (D)
Assuming a character pointer c is declared as char *c = "abcd" in main(), the function call fX(c) will always return a value
Show answer
Official answer: A,B,D
Practise this question with exam-style marking