Home » C Programming » Functions

Functions cannot return a floating point number

Correct Answer: No

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


← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion