Posts

Showing posts from May, 2025

FUNCTIONS

 FUNCTIONS Functions are like reusing code that you have written rather writing everything from scratch. For example like  in CPP //header file #include<iostream> using namespace std; // main program int main(){ //this will display hello world cout<<"hello world"; return 0; } now with function #include<iostream> using namespace std; //funtion declaration void Hello_World(){} int main(){ //calling funtion Hellow_World(); return 0; } //defining funtion void Hello_World(){ cout<<"hello world"; } here funtion can be divided in 3 parts Declaration:  means to tell it's name and it's arguments and with their type. Defination:means to tell what will be inside of it and what will it do. Calling: means to call that function using it's name or provoking it. So by this we are calling the function to print hello world rather writing the code from scratch. For more you can watch below link of YoutTube video :  Functions