FUNCTION DECLARATION IN C

Maha


Function Declaration In C

A function is a group of statements that perform a specific task. A function is defined by specifying its name, return type, and parameters, and its definition consists of a block of code enclosed in curly braces. 

Syntax:

return_type function_name(data_type parameter...)
{
//code to be executed.
}


Program:


  #include <stdio.h>
  int myFunction(int x, int y){
  return x + y;
  }
   int main(){  
   int result = myFunction(10, 3); 
   printf("Result is = %d", result);
   return 0;
  }


Output:


  Result is = 13





More topic in C

Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send