Computer Programming Concepts | College-Pages.com:: C++ was preceded by C, a language that uses long strings of written code to A Quick Lesson On Object-Oriented Programming. Computer Science Technology http://www.college-pages.com/computer-programming-concepts/416HOME |
What are Functions?
a function is a block of code that is identified by some name and can take zero or more parameters and can return some value.
example: consider the following function, which squares a number.
float square(float num)
{
float answer = num * num;
return answer;
}
The first line of the function is called its declaration
line.It has three parts.
The first part is its return type. ScienceDaily: Software News:: Computer Programming. Computer Science. Distributed Computing. Encryption. Hacking Questions? Your Name: Your Email: Comments: Click button to submit feedback: http://www.sciencedaily.com/news/computers_math/softwareHOME | Cprogramming.com Article: Graphs in Computer Science:: name content=C and C++ game programming> s. Web Questions. Programming FAQ. Message Board. Ask an Expert. Email. Computer Science Theory: Graphs http://www.cprogramming.com/tutorial/computersciencetheory/graphtheory.htmlHOME |
The return type tells you what kind of data the function
will give you back. If it returns nothing, then its return
type would be void.
The second thing is the name of the function. Function names follow the same guidelines as variable names. It is a good idea to have
the function name reflect what the function will do.
Next, inside the parenthesis, we have parameters. A parameter is some value you pass to the function in order for it to work. Computer Science:: Asked Questions. Computer Science. Download the Practice Booklet (PDF) C. Programming languages and notation. Constructs for data organization and program control http://www.ets.org/vgn-ext-templating/v/?vgnextoid=e9952d3631df400VgnVCM10000022f95190RCRDHOME |
For example, in this case, to square a number, we have to give it the number to square.
For more :http://www.cplusplus.com/doc/tutorial/fu...
Consult any C++ programming book.....
A procedure which helps you to perform a certain task like finding a square root or something like that.
Now there are functions like printf or scanf which are system defined and some are user defined means u have to create....
Functions are a piece of code that encapsulates some computation. They allow you to abstract repeated operations into a distinct "chunk" that you can "call". Functions typically have a few inputs (usually called "arguments") and usually one output (often called a "return value").
In some languages (e.g. Lisp) you can return as many values from a function as you want. In other languages such as C, only one value may be returned from a function so sometimes the function modifies one of its arguments, say an array, to provide a similar result.
In purely functional situations, a function cannot modify anything at all. The only thing that determines what a function does is what goes into it (its arguments). And the only effect felt from the function is the return value.
What dress should i wear for an interview ?
Financial Representative =Insurance salesman?
|