Function Forward Declaration - C Function

C examples for Function:Function Definition

Introduction

A function must be declared before it can be called.

This can be achieved by

  • placing the function's implementation before any references to it, or
  • adding a declaration of the function before it is called.

Demo Code

#include <stdio.h>
void myFunction(int a); /* prototype */

int main(void) {
  myFunction(0);//from w  w w. ja  v a  2s .  co m
}

void myFunction(int a) {}

The parameter names do not need to be included in the prototype, only the data types are required.

void myFunction(int);

Related Tutorials