Write a Hello World program in C using function

 Here we are going to write a Hello World program in C using function. Earlier we have done this program normally that is just c program to print hello world. This time we will do this using function. 

First we will create a function named printhelloworld() of void return type and it won't take any parameter. Just print the hello world.

Then in main function, we will call the printhelloworld() function that's it.

Now lets code it. But before going down I will suggest you to first try it on your own and then see the solution.

Write a Hello World program in C using function 

#include <stdio.h>

void printhelloworld(){
     printf("Hello, World!");
}

int main(){
   printhelloworld();
   return 0;

}


Output

Hello, World!


C Programs list 

Post a Comment

If you have any doubts, please let me know

Previous Post Next Post