Problems in passing arguments by parameter

0

I'm having trouble passing arguments by parameter. The error occurs in line 23 column 5 and is as follows:

  

too few arguments to function 'imc'

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include <unistd.h>

float imc(float tam, float pes);

int main()
{
    float altura;
    float peso;
    float resultado;

    printf("digite a sua altura ");
    scanf("%f",&altura);
    printf("\n\ndigite seu peso ");
    scanf("%f", &peso);

    imc(altura,peso);

    system("clear");

    printf("%f", imc(resultado));

    return 0;
}

float imc(float tam, float pes)
{

    return tam*pow(pes,2);
}
    
asked by anonymous 24.10.2014 / 16:03

2 answers

4

If you repair your function imc you are prompted for two parameters: float imc(float tam, float pes) .

In your printf you have printf("%f", imc(resultado)); , that is, from the moment you are sending a parameter ( resultado ), it will give parameter error.

Do not do this:

resultado = imc(altura,peso);

system("clear");

printf("%f", resultado);
    
24.10.2014 / 16:10
1

The problem is with the function call,

float imc(float tam, float pes)

Because in line 23 the function imc requests two arguments and you are only passing one.

    
24.10.2014 / 16:09