Function Declaration in C Language:
(1) In this blog we will see how to declare Function in C Language.
(2) It is recommended for optimizing the code. It should be advisable to write separate function definitions and function declarations.
(3) You can add as many parameters as you want.
(4) Sample C language code and its output, as shown:
#include <stdio.h> #include <conio.h> void myfirstfunction(int x);// Declare function with parameter intmain() { int x; x = 3; myfirstfunction(x); //call the function by passing x parameter getch(); return 0; } void myfirstfunction(int x) // Creation of new function with parameter { switch(x) { case 1: printf(“LOW”); break; case 2: printf(“Medium”); break; case 3: printf(“High”); break; } } |

(5) After that go to the “Build” menu and select the “Build” option for publishing the code as shown.

(6) After building the code, press the “Run” button, as shown.

(7) After pressing the “run” button, the output screen is opened, as shown.
