#include <stdio.h>
// Define a function that takes two integers as arguments and returns their sum
int add(int a, int b) {
return a + b;
}
// Define a function that takes no arguments and returns nothing
void print_hello(void) {
printf("Hello, world!\n");
}
int main(void) {
// Call the add function and print the result
int result = add(3, 4);
printf("The sum of 3 and 4 is %d\n", result);
// Call the print_hello function
print_hello();
return 0;
}
This program defines two functions: add
, which takes two integers as arguments and returns their sum, and print_hello
, which takes no arguments and returns nothing. It then calls these functions from the main
function and prints the result of the add
function to the console.
Here is an example of the output of this program:
The sum of 3 and 4 is 7
Hello, world!
0 Comments