function
15 ResultsDictionary
function
In programming, a self-contained software routine that performs a task. Functions can do a large amount of processing or as little as adding two numbers and deriving a result. Values are passed...
Dictionary
Definition: function
In programming, a self-contained software routine that performs a task. Functions can do a large amount of processing or as little as adding two numbers and deriving a result. Values are passed to the function, and values may be returned. Or, the function may just perform the operation and not return a resulting value. The concept of a function within a program is that, once written, it can be used over and over again without the programmer having to duplicate the same lines of code in the program each time that same processing is desired.
Standard and Programmer-Defined
Programming languages provide a set of standard functions as well as allow programmers to define their own functions. For example, the C and C++ programming languages are built entirely of functions and always contain a "main" function.
The Application Programming Interface (API)
Functions in one program can also be called for by other programs and shared. For example, operating systems can contain more than a thousand functions to display data, print, read and write disks and perform a myriad of tasks. Programmers write their applications to interact with the OS using these functions. This list of functions is called the "application programming interface" (API).
Function Calls
Functions are activated by placing a "function call" statement in the program. The function call often includes values (parameters) that are passed to the function. When called, the function performs the operation and returns control to the instruction following the call. The function may return a value or not. Writing a program in a language such as C/C++ involves calling language functions, one's own functions and operating system functions (APIs). There is a whole lot of function calling. See function prototype, API and interface.
A Function Call Example: Open and Read
The example below shows two very simplified API functions to open and read a file.
The OPEN function is called to read the file "budget.txt," and the function returns a value in the variable HANDLE. If the file was opened successfully, HANDLE might contain a positive number, but if not, a negative one. The value in HANDLE is then passed to the READ function to read so many bytes (LENGTH) of the file into a memory area called INPUTBUFFER. The OPEN function returns the number of bytes read in the SIZE variable.
handle = open("budget.txt");
size = read(handle, InputBuffer, length);
THIS DEFINITION IS FOR PERSONAL USE ONLY
All other reproduction is strictly prohibited without permission from the publisher.
© 1981-2010 The Computer Language Company Inc. All rights reserved.
Sponsored White Papers, Webcasts & Resources
-
Get Your Free Trial of Diskeeper 2011 Professional
Give your business desktops and laptops a boost. Diskeeper 2011 Professional prevents the majority of fragmentation before it can happen and brings data flow up to peak speed for the best possible...
-
The common error of overloading mobile apps with features
The crowded app stores drive developers to put lots of features in their mobile apps. This is a mistake, as simple, focused apps rise to the top.
-
'Highly critical' flaws haunt phpMyAdmin
Developers of the open-source phpMyAdmin have released a new version to patch several "highly critical" vulnerabilities that can be used to compromise a vulnerable system.
-
Architectural layers
Abstracting IT functions and services into service layers is a great idea, but don't over do it, as Geek & Poke's Oliver Widder reminds us.... [caption id="" align="alignleft" width="500"...
-
Cellphones are becoming useless at their primary function - Voice and text
I've noticed a very disturbing trend. It's that cellphones are becoming useless at their primary function - which is voice and text.
-
ThinPrint addressing the boring but absolutely necessary
I spoke with ThinPrint CEO, Henning Volkmer, about a rather boring, but absolutely necessary function in a computing environment. Printing is one of those functions that is taken for granted...
-
-
Are appliances the answer?
Are appliances the answer? That depends entirely on the question of course. I've spoken with a number of suppliers who have "encapsulated" a function and are selling it as an appliance server....
-
The case for Scala
Programming languages are like screwdrivers for developers. One size does not fit all, so good programmers keep several in their tool belt. The problem is, new languages are coming out all the...
-
Flower robots for your home
Flower robots are not new and some have already been developed in the U.S. Now, South Korean researchers have created a robotic plant which acts like real ones. This robot has humidifying,...
-
What is virtualization?
As I'm preparing to leave VMworld, I find myself thinking about a question I heard at the event. That question is "what is virtualization?". Living in the virtual world a great deal of the time,...
-
Yo Philly: iSepta perfect for Philly iPhone users
Having spent almost 20 years in Philadelphia iSepta is one application that I can relate to. SEPTA, for the uninitiated, is the South Eastern Pennsylvania Transportation Authority. SEPTA runs...
-
Tideway Systems Simplifies Mapping Application Dependencies
I had the delightful opportunity to speak with Richard Muirhead, Tideway Systems' Founder and CEO, about the launch of the newest release of Tideway Foundation. The company is focused on making...
-
In the 'it's a feature' department: Caps Lock keys
If you've noticed a change in the behavior of your Caps Lock key on new Apple machines, that may be the sign of a feature, not a bug.
-
QuickOffice Premier 4.5 is essential in turning your S60 device into a multimedia computer
When you buy a Nseries or one of the various other supported Nokia devices found around the world then you will find that the QuickOffice software is preinstalled as the Office document. However,...
-
'Storm worm' exploits YouTube
Spammers may have changed tactics, targeting a familiar Web site rather than PCs for the purpose of spreading the trojan.
-
Using lambda functions
This five minute video explores how to use lambda functions in concert with Threaded Building Blocks to make parallel code more readable.
Additional Results
-
Windows 8: Media Center functionality likely to cost more
Microsoft pushing Media Center users to Pro version.
-
NASA: Hackers had 'full functional control'
NASA this week released details of security breaches the organization has recently experienced. Out of 47 attempts last year, hackers managed to penetrate NASA's computer network 13 times.
-
First impressions of the Nike+ Fuelband; elegant design, limited functionality
The Nike+ Fuelband is extremely difficult to find and the harder it is to find, the more attractive it seems to be to buyers. I've spent a few hours with it and find the design to be excellent so far.
-
The iSkin aura Year of the Dragon case is distinctive and functional
There is an overwhelming number of iPhone cases, but every once in a while you find something that stands out above the rest. iSkin makes some great cases and their new Year of the Dragon aura...
-
Samsung's new series of monitors combine style and function, 'stunction'? (photos)
Samsung's new Series 7 and 9 monitors look beautiful enough for two slideshows in one week.
The best of ZDNet, delivered
ZDNet Newsletters
Get the best of ZDNet delivered straight to your inbox




