function declaration in c code example
Example 1: what is system function in c
The system() function is a part of the C/C++ standard library. It is used to pass the commands that can be executed in the command processor or the terminal of the operating system, and finally returns the command after it has been completed.
<stdlib.h> or <cstdlib> should be included to call this function
Example 2: function in c
#include <stdio.h>
void function(){
printf("I am a function!");
}
int main(void) {
function();
}
Example 3: how to write function in c
#include <stdio.h>
int MyAge() {
return 25;
}
int main(void) {
MyAge();
}
Example 4: functions in c programming
#include <stdio.h>
void introduction()
{
printf("Hi\n");
printf("My name is Chaitanya\n");
printf("How are you?");
}
int main()
{
introduction();
return 0;
}
Example 5: functions in c programming
#include <stdio.h>
int addition(int num1, int num2)
{
int sum;
sum = num1+num2;
return sum;
}
int main()
{
int var1, var2;
printf("Enter number 1: ");
scanf("%d",&var1);
printf("Enter number 2: ");
scanf("%d",&var2);
int res = addition(var1, var2);
printf ("Output: %d", res);
return 0;
}