W7Code » C Language » Functions in C Programming Language

Functions are code sequences that accept arguments and return a result. We have been using functions in c since the beginning. Scanf and printf are functions examples, that we have been using. Functions keep our code organized. We will learn how to build a function.


Function Syntax


Syntax Explained

  • In C we need to declare the type of variable, normally we set the type depending in what value the function will return;
    • variable type: char, int, float.
  • If necessary we declare a variable. If we declare the variable inside the function we name it local variable, if we declare a variable out of function keys we name it global variable;
  • Then we set all code instructions to execute;
  • At the end of the function we return a value or an expression.



If we declare a variable of type void, that means that function don’t return any type of value/data.

Example of a void function


Example of Functions in c

This function multiplies two numbers


This function see what number is the highest


If you want more examples of functions in c please comment bellow!


Leave a Reply