Home / C Programming / Functions :: Discussion

Discussion :: Functions

  1. There is a error in the below program. Which statement will you add to remove it?

     #include
    
     int main()
     {
         int a;   
         a = f(10, 3.14);   
         printf("%d\n", a);     
         return 0;
     }
     float f(int aa, float bb) 
     {   
       return ((float)aa + bb); 
     } 
    

  2. A.

    Add prototype: float f(aa, bb)

    B.

    Add prototype: float f(int, float)

    C.

    Add prototype: float f(float, int)

    D.

    Add prototype: float f(bb, aa)

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    The correct form of function f prototype is float f(int, float);


Be The First To Comment