Line
void add_two_numbers (int var1, int var2);
It is a function prototype, not a call to the specified function. It’s unusual to see this in the middle of a function, but this is certainly true as it’s just a declaration style in accordance with the standard ( ISO C11 6.7).
To actually call a function, you should use something like:
add_two_numbers (var1, var2);
, , , , . - :
#include <stdio.h>
void add_two_numbers (int a, int b) {
int c;
c = a + b;
printf ("%d\n", c);
}
int main (void) {
int var1, var2;
var1 = 1;
var2 = 53;
add_two_numbers (var1, var2);
return 0;
}
, :
#include <stdio.h>
void add_two_numbers (int, int);
int main (void) {
int var1, var2;
var1 = 1;
var2 = 53;
add_two_numbers (var1, var2);
return 0;
}
void add_two_numbers (int a, int b) {
int c;
c = a + b;
printf ("%d\n", c);
}
, :
- .
add_two_numbers, , . , print_sum_of_two_numbers. - , :-)
add_two_numbers printf ("%d", a + b);. - ,
main add_two_numbers (1, 53);. - C99,
main, "", . , , , , , , .
:
#include <stdio.h>
void print_sum_of_two_numbers (int a, int b) {
printf ("%d\n", a + b);
}
int main (void) {
print_sum_of_two_numbers (1, 53);
}