What are Functions - C Function

C examples for Function:Function Definition

Introduction

Functions are code blocks.

You need to call it to execute it.

Functions can be used to divide programs into smaller parts.

Here is a function definition.

void myFunction(void) {
  printf("Hello World");
}

Calling Functions

To invoke it, the function's name is specified followed by an empty set of parentheses.

Demo Code

#include <stdio.h>

void myFunction(void) {
  printf("Hello World");
}

int main(void) {

  myFunction(); /* "Hello World" */
}

Result


Related Tutorials