Recent

Programming: Functions Vs Procedures

What is the difference between Functions and Procedures in programming languages?

to understand the difference between functions and procedures we first have to have a look at what are functions and what are procedures.

Functions
functions are the part of today's programming languages in which when we want to use same code again and again, we simply put it into function, then we simply have to call that function whenever we want to use it. Like once we manufactured a printer then whenever want to use to we don't need to manufactured it again we simply use, same concept is for functions, let's we build a simple function which will generate a cube of the given number in C Language, you can use the same concept in other languages like Java, C#, Python, Javascript, PHP and many other languages.

int getcube(int val)
{

return val*val*val;

}

when you call the above getcube() function you will have to put a number whose cube you want, so let's give it some numbers and see what will it return.

code:
getcube(3);

result:
27

code:
getcube(10);

result:
1000

No comments