In c, we can divide a large program into the basic building blocks known as function. The function contains the set of programming statements enclosed by {}. A function can be called multiple times to provide reusability and modularity to the C program. In other words, we can say that the collection of functions creates a program. The function is also known as procedureor subroutinein other programming languages
#include<stdio.h>
void printName();
void main ()
{
printf(“Hello “);
printName();
}
void printName()
{
printf(“Javatpoint”)
}
Output
Hello Javatpoint
- Functions in C are the basic building blocks of a C program.
- A function is a set of statements enclosed within curly brackets ({}) that take inputs, do the computation, and provide the resultant output.
- You can call a function multiple times, thereby allowing reusability and modularity in C programming.
The provided code snippet demonstrates the use of functions in C programming. Here’s a breakdown of how the code works:
- The
#include <stdio.h>line includes the standard input/output library, which is necessary to use functions likeprintf(). - The code declares a function called
printName()using the function prototype syntaxvoid printName();. This prototype informs the compiler about the existence of the function before it is actually defined. - The
main()function is the entry point of the program. It is where the program execution begins. In this code,main()calls theprintf()function to print “Hello ” to the console. - Next,
main()calls theprintName()function. When a function is called, the program execution transfers to that function. - The
printName()function is defined belowmain(). It prints “Javatpoint” to the console using theprintf()function. - After the
printName()function is executed, the program control returns to themain()function, and any remaining statements inmain()are executed. - The program terminates, and the expected output is:
Hello Javatpoint
In summary, the printName() function is called from the main() function, allowing for modularity and reusability of code. The program output displays “Hello Javatpoint”.

The provided code snippet demonstrates the use of functions in C programming. Here’s a breakdown of how the code works:
The #include line includes the standard input/output library, which is necessary to use functions like printf().
The code declares a function called printName() using the function prototype syntax void printName();. This prototype informs the compiler about the existence of the function before it is actually defined.
The main() function is the entry point of the program. It is where the program execution begins. In this code, main() calls the printf() function to print “Hello ” to the console.
Next, main() calls the printName() function. When a function is called, the program execution transfers to that function.
The printName() function is defined below main(). It prints “Javatpoint” to the console using the printf() function.
After the printName() function is executed, the program control returns to the main() function, and any remaining statements in main() are executed.
The program terminates, and the expected output is:
Code:
Hello Javatpoint
In summary, the printName() function is called from the main() function, allowing for modularity and reusability of code. The program output displays “Hello Javatpoint”.