Answers for "declare function"

C
2

javascript function declaration

//Four ways to declare a function
function add(a, b) {
  return a + b;
}

var add = function(a, b) {
  return a + b;
}

var add = (a, b) => {
  return a + b;
}

var add = (a, b) => a + b;
Posted by: Guest on June-06-2020
5

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();
}
Posted by: Guest on April-11-2020
0

The syntax to declare a function is:

returnType functionName (parameter1, parameter2,...) {
    // function body   
}
Posted by: Guest on May-03-2021

Code answers related to "C"

Browse Popular Code Answers by Language