I’m not sure how to pass on the variables from main() to another function.
I have something like this:
main()
{
float a, b, c;
printf("Enter the values of 'a','b' and 'c':");
scanf("%f %f %f",&a,&b,&c);
}
double my_function(float a,float b,float c)
{
double d;
d=a+b+c
bla bla bla bla
How can I pass a, b and c from main to my_function? For now the program stops on scanf() and finishes straight after I put my values in.
I’ve seen different examples here but they didn’t help me much.
Just call the function by passing the parameters
a,b, andc. Syntax:Like this: