C Programming - Functions - Discussion
Discussion Forum : Functions - Yes / No Questions (Q.No. 1)
1.
Functions cannot return a floating point number
Answer: Option
Explanation:
A function can return floating point value.
Example:
#include <stdio.h>
float sub(float, float); /* Function prototype */
int main()
{
float a = 4.5, b = 3.2, c;
c = sub(a, b);
printf("c = %f\n", c);
return 0;
}
float sub(float a, float b)
{
return (a - b);
}
Output:
c = 1.300000
Discussion:
4 comments Page 1 of 1.
Swati said:
6 years ago
Can anyone explain this?
The default return type of function is int. Then how can it return float value?
The default return type of function is int. Then how can it return float value?
Serwit said:
8 years ago
@Pradip &Amp; Arpit read question properly.
Pradip & arpit said:
8 years ago
Ans is A not B.
The function can be return float value.
The function can be return float value.
Vivek said:
1 decade ago
Can anyone explain it further?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers