Easy C & C++
Sunday, November 14, 2010
Friday, November 5, 2010
What is Parameter and why we use it
Parameters are the instance of a function so that the function can do something with it and may produce some output. Like a real world example of making a cup of tea you need four things tea,milk,sugar and water so here these are the parameters for Making_Tea() function.
For a code example
main()
{
printf("We are producing %d cup of tea",making_tea(1,2,3,4));
getch();
}
int making_tea(int param1,int param2, int param3, int param4)
{
int output;
output=param1+param2+param3+param4;
return output;
}
For a code example
main()
{
printf("We are producing %d cup of tea",making_tea(1,2,3,4));
getch();
}
int making_tea(int param1,int param2, int param3, int param4)
{
int output;
output=param1+param2+param3+param4;
return output;
}
Subscribe to:
Posts (Atom)