function in c
#include <stdio.h>
void function(){
printf("I am a function!");
}
int main(void) {
function();
}
function in c
#include <stdio.h>
void function(){
printf("I am a function!");
}
int main(void) {
function();
}
functions in c programming
#include <stdio.h>
int addition(int num1, int num2)
{
int sum;
/* Arguments are used here*/
sum = num1+num2;
/* Function return type is integer so we are returning
* an integer value, the sum of the passed numbers.
*/
return sum;
}
int main()
{
int var1, var2;
printf("Enter number 1: ");
scanf("%d",&var1);
printf("Enter number 2: ");
scanf("%d",&var2);
/* Calling the function here, the function return type
* is integer so we need an integer variable to hold the
* returned value of this function.
*/
int res = addition(var1, var2);
printf ("Output: %d", res);
return 0;
}
how to write function in c
#include <stdio.h>
// Here is a function declaraction
// It is declared as "int", meaning it returns an integer
/*
Here are the return types you can use:
char,
double,
float,
int,
void(meaning there is no return type)
*/
int MyAge() {
return 25;
}
// MAIN FUNCTION
int main(void) {
// CALLING THE FUNCTION WE MADE
MyAge();
}
functions in c programming
#include <stdio.h>
/* function return type is void and it doesn't have parameters*/
void introduction()
{
printf("Hi\n");
printf("My name is Chaitanya\n");
printf("How are you?");
/* There is no return statement inside this function, since its
* return type is void
*/
}
int main()
{
/*calling function*/
introduction();
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us