c - 2 Functions in 1 main program(Visual Studio 2013) -
i wanna add 2 variables.in main program 2 functions. use visual studio 2013.there appears error c2660: 'function2': function not accept arguments 1
#include "stdafx.h" #include <stdio.h> #include <stdlib.h> double funktion1(); double funktion2(); int main() { double c; { c=funktion1(); funktion2(); //line 14 } return 0; } double funktion1() { double a, b, c; printf("add 2 numbers!"); scanf_s("%lf%lf", &a, &b); c = + b; return c; } double funktion2(double c) { printf("\n result: %lf", c); //line 29 }
thx help!
you use variable double c
in statement printf
. @ point, haven't assigned value c
. warning, or error in case, telling you.
update:
when need return value of funktion1
in funktion2
, must pass parameter, e.g.
int main() { double c; c = funktion1(); funktion2(c); } /* ... */ void funktion2(double c) { printf("\n result: %lf", c); //line 29 }
Comments
Post a Comment