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...
Explanation:
In C, functions can return any type except array and functions. This means that a function can return a value of any data type such as int, float, char, double, struct, etc. However, it cannot return an array or another function.

Why functions cannot return arrays or functions?
The reason why functions cannot return arrays or functions is that C does not allow passing an array as a function argument. Instead, an array is automatically converted into a pointer to its first element. Therefore, if a function returns an array, it would actually be returning a pointer to the first element of the array. Similarly, if a function returns a function, it would actually be returning a pointer to that function.

Why functions cannot return union?
A union is a special data type in C that allows storing different data types in the same memory location. However, since the size of a union is determined by its largest member, it can be difficult to determine the size of the union at compile-time. Therefore, C does not allow returning a union from a function.

Why functions cannot return function pointer?
A function pointer is a variable that stores the address of a function. Since a function pointer can be of any function type, it can be difficult to determine its size at compile-time. Therefore, C does not allow returning a function pointer from a function.

Therefore, the correct answer is option 'B' - Functions can return any type except array and functions.
Free Test
Community 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.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

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