Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Which of the following is true about return t... Start Learning for Free
Which of the following is true about return type of functions in C?
  • a)
    Functions can return any type
  • b)
    Functions can return any type except array and functions
  • c)
    Functions can return any type except array, functions and union
  • d)
    Functions can return any type except array, functions, function pointer and union
Correct answer is option 'B'. Can you explain this answer?
Most Upvoted Answer
Which of the following is true about return type of functions in C?a)F...
In C, functions can return any type except arrays and functions. We can get around this limitation by returning pointer to array or pointer to function.
Free Test
Community Answer
Which of the following is true about return type of functions in C?a)F...
Understanding Return Types in C
In C programming, functions play a crucial role, and their return types define what kind of data a function can send back to the caller.
1. Functions Can Return Any Type
- Functions in C can return various types, including:
- Primitive types (int, char, float, double)
- User-defined types (structs, enums)
- Pointers to any data type
2. Limitations on Return Types
- Arrays:
- Functions cannot return arrays directly. Instead, you can return a pointer to the first element of the array.
- Functions:
- You cannot return a function. However, you can return a pointer to a function, which can be used to call the function indirectly.
3. Why Option B is Correct
- The correct answer is option B, which states that functions can return any type except for arrays and functions. This is because:
- Arrays decay to pointers when passed to functions, and thus, returning an array would require returning a pointer, which is permissible.
- Functions themselves cannot be returned, but function pointers can be.
4. Clarification on Other Options
- Option C: Incorrect because unions can indeed be returned.
- Option D: Incorrect as it includes function pointers, which can be returned.
In summary, while C functions can return a variety of data types, the inability to return arrays and functions directly is a key characteristic. Understanding these limitations is essential for effective programming in C.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Which of the following is true about return type of functions in C?a)Functions can return any typeb)Functions can return any type except array and functionsc)Functions can return any type except array, functions and uniond)Functions can return any type except array, functions, function pointer and unionCorrect answer is option 'B'. Can you explain this answer?
Question Description
Which of the following is true about return type of functions in C?a)Functions can return any typeb)Functions can return any type except array and functionsc)Functions can return any type except array, functions and uniond)Functions can return any type except array, functions, function pointer and unionCorrect answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Which of the following is true about return type of functions in C?a)Functions can return any typeb)Functions can return any type except array and functionsc)Functions can return any type except array, functions and uniond)Functions can return any type except array, functions, function pointer and unionCorrect answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Which of the following is true about return type of functions in C?a)Functions can return any typeb)Functions can return any type except array and functionsc)Functions can return any type except array, functions and uniond)Functions can return any type except array, functions, function pointer and unionCorrect answer is option 'B'. Can you explain this answer?.
Solutions for Which of the following is true about return type of functions in C?a)Functions can return any typeb)Functions can return any type except array and functionsc)Functions can return any type except array, functions and uniond)Functions can return any type except array, functions, function pointer and unionCorrect answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Which of the following is true about return type of functions in C?a)Functions can return any typeb)Functions can return any type except array and functionsc)Functions can return any type except array, functions and uniond)Functions can return any type except array, functions, function pointer and unionCorrect answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Which of the following is true about return type of functions in C?a)Functions can return any typeb)Functions can return any type except array and functionsc)Functions can return any type except array, functions and uniond)Functions can return any type except array, functions, function pointer and unionCorrect answer is option 'B'. Can you explain this answer?, a detailed solution for Which of the following is true about return type of functions in C?a)Functions can return any typeb)Functions can return any type except array and functionsc)Functions can return any type except array, functions and uniond)Functions can return any type except array, functions, function pointer and unionCorrect answer is option 'B'. Can you explain this answer? has been provided alongside types of Which of the following is true about return type of functions in C?a)Functions can return any typeb)Functions can return any type except array and functionsc)Functions can return any type except array, functions and uniond)Functions can return any type except array, functions, function pointer and unionCorrect answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Which of the following is true about return type of functions in C?a)Functions can return any typeb)Functions can return any type except array and functionsc)Functions can return any type except array, functions and uniond)Functions can return any type except array, functions, function pointer and unionCorrect answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev