codegurukool.com · Free coding tutorials & online compiler

Home › C Tutorial › C functions

C functions

Reusable blocks.

Define a return type, name and parameters. Declare a prototype above main if the definition comes after it.

Example code

#include <stdio.h>
int square(int n);
int main() {
  printf("%d\n", square(6));
  return 0;
}
int square(int n) { return n * n; }

Run this code in the online editor

← C pointersFunction parameters →