Hello World Program in C Using Function

Hello world program in c using function for beginners to understand how the function implementation is working for hello world program in c using function.

Function Definition in C

Declaration of a function In a C program, a function must be declared globally to inform the compiler of the function name, parameters, and return type. Calling a function Anywhere in the program, a function can be called. 

A function is a relation in which each value from the set of ordered pairs first components is associated with exactly one value from the set of ordered pairs’ second components.

Void Function in C Program

Nonvalue-returning functions, also known as void functions, are used in the same way as value-returning functions, with the exception that void return types do not return a value when the function is executed. 

After completing its task, the void function returns control to the caller. The call to the void function is a standalone statement. This is sample code for hello world program in c using function.

Return Statement in C

A return statement marks the end of a function’s execution and hands control back to the calling function. 

The calling function resumes execution at the point where the call was made. A return statement can give the calling function a value. 

When a function completes its task, it returns a value to the script or function that called it.

#include<stdio.h>
void function()
{
printf("Hello World");
}
int main()
{
function();
return 0;
}

Output:

Hello World