Functions

Q1: Functions cannot return a floating point number

A Yes

B No

ANS:B - No

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



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.