This is the source code from the C Programming Tutorial. In this source code, you are going to learn about c functions in a C Programming language.
What is Function?
A function is a block of code that can perform a specific task. In C Programming there are two types of c functions
- Standard function
- User-defined function
Standard function
A function which is predefined in c programming is called a standard function.
Here is an example of a standard function.
//standard fuctions in c #include <stdio.h> #include <stdlib.h> int main () { printf("I'm standard function in c programmig"); return 0; }
Here main()
and printf()
functions are standard function. So, we use main()
function to execute the c program and printf()
function to print text on the screen.
User-defined function
Now let us discuss user-defined function.
User-defined function are the functions which are defined by the user.
Example of user-defined function
#include
<stdio.h>
#include
<stdlib.h>
void name(); // function prototype declaration
int main () {
name(); // function call
printf("I am main function \n");
return
0;
}
// function definition
void name(){
printf("I am name function \n");
}