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);
![]() | Reproduced with permission from Computer Desktop Encyclopedia. Copyright (c) 1981-2009 The Computer Language Company Inc. All rights reserved. |
Additional Resources
- AFP-Lookup Complete 3.1 (Windows)
- You can use AFP-Lookup Complete to obtain a structured overview of each of your AFP files. All MO:DCA structured fields-- even those that have since been rejected by Infoprint--are displayed in their respective hierarchy in a familiar Explorer interface. You can use this stable software to analyze even corrupt AFP...
- Software downloads 2009-11-04
- Kidneys do not like those chip and diet soda lunches
- Linn and Gary Curhan published two studies, one of which found a correlation between high sodium intake and kidney function decline (that's the chips), the other of which found a correlation between artificial sweetener intake and kidney function loss (that's the diet soda.) by Dana Blankenhorn
- Blog posts 2009-11-03
- SharePoint Alert Reminder Boost 1.9.1023 (Windows)
- SharePoint2007 Alert Me sends email notification when list item content is created, modified or deleted. But it is function-limited when applied in a complex enterprise environment. For instance, if you want the assignees on a task list get notification when they are assigned to a task, with SharePoint "Alert Me",...
- Software downloads 2009-11-02
- TurboBackup 7.3 (Windows)
- TurboBackup helps you to back up any types of critical data to secure places that you are comfortable. This includes almost all media types, including hard disk, USB flash drive, CD/DVD, Blu-ray, HD DVD, and remote servers, with optional compression, on demand or via scheduling. Restore these save points easily....
- Software downloads 2009-11-01
- Ubuntu 9.10 = easiest, cheapest upgrade ever
- Worst OS ever! You should read what Dana Blankhorn had to say about your beloved linux! I'll give you a hint, its not good. I can't believe they would release a distro with known harddrive bugs. I'm going to laugh at you when you lose all your data due...
- Discussion threads 2009-10-29
- fp Plugin 2.5 (Mac)
- Using my own fp multi-precision engine, fp Plugin for REALbasic adds two new data types, BigInteger and BigFloat. Except for available memory, there is no limitation on the size of a BigInteger. BigFloat is a multi--precision floating point number. You can set both the internal precision and the decimal output...
- Software downloads 2009-10-28
- iFinance Toolkit Pro for iPhone 1.9 (Mobile)
- iFinance Toolkit Pro for iPhone provides essential financial software for users to analyze their financial investments. Powerful financial engine designed to answer ninety percent of your financial questions with a user interface requiring only a few keystrokes. It contains basic calculator, time value of money, net present value and internal...
- Software downloads 2009-10-27
- MyWebClip Lite for iPhone 1.0.1 (Mobile)
- MyWebClip Lite for iPhone is a well executed way to manage web app bookmarks. It is a new browser app with additional home screen spaces to manage your bookmark icons. You can create, add, and organize up to 144 bookmark icons and speed dial icons, and you will be able...
- Software downloads 2009-10-26
- Send Mail Expert 1.3 (Windows)
- Send Mail Expert can control randomize: From name, From emails, Subjects, Reply to, Proxy, IP address, Email Header, Email Body. All such randomization will guarantee that your email will bypass all the filters (Junk Mail Filter, Block List...) and delivered safely to your customers. Send Mail Expert offers you a...
- Software downloads 2009-10-23
- Samsung Moment (Sprint)
- In case you haven't noticed, the Google Android dam has broken. For almost a year HTC was the only manufacturer to offer handsets with the operating system, but in the past month, Motorola and Samsung almost fell over each other to offer Android smartphones of their own. Moto gave us...
- Product reviews 2009-10-22
- Toshiba Satellite T135-S1310
- How much of a difference does a single-core versus dual-core ultralow-voltage processor make on a thin-and-light these days? You may not be paying attention under the hood--and that's not your fault, because it's hard to notice the differences based on processor name and Intel sticker-logos--but you should know that it...
- Product reviews 2009-10-22
- Gaping security hole in Time Warner cable routers
- how about telling us how to fix it?Can the customer log into their own router and change the vulnerable settings? Please advise.Patetic simply pateticThis is a worst case scenario... Time Warner is guilty of having used the same Admin Name/Password on all their routers and from what I read on...
- Discussion threads 2009-10-22
- Karsa Fulltext Manager 1.0.3 (Windows)
- Karsa is a full text component thanks to which you can easily install sophisticated full text search function into your Web or desktop application. It is the first full text component meant for installation into one's own applications which provides really extensive options for setting of weights over searched data....
- Software downloads 2009-10-22
- Windows 7 puts Vista into perspective: Only a 'failure' in retrospect
- The fault lies with MS and Driver manufacturersWe don't criticize macs because they are a package deal, with a price premium to match so they generally work just fine. We don't call for witch hunts of Linux distro's because we expect to have problems and tweaks with Linux, plus it's...
- Discussion threads 2009-10-19
- Five steps before moving to Windows 7
- I found this part disturbing.[i] Gartner estimated that it will cost US$339 to US$510 per user to move from Windows Vista to Windows 7, and US$1,035 to US$1,930 per user to move from Windows XP to Windows 7.[/i]Unless that includes more than just the OS. A site license should cost...
- Discussion threads 2009-10-16
- LG Bliss - white (US Cellular)
- LG is one of the top makers of touch-screen feature phones, and though many of them go to big national carriers like Verizon Wireless and AT&T Wireless like the LG enV Touch and the LG Xenon for example, quite a number of them make it to regional carrier U.S. Cellular...
- Product reviews 2009-10-14
- Cleanse Uninstaller Pro 6.0.1 (Windows)
- Cleanse Uninstaller Pro is a advanced uninstaller that finds and remove even the most stubborn of programs. Uninstall faster, easier and more completely than you do with other programs. Using the Auto Find function all you have to do is drag and drop the programs icon you want to uninstall...
- Software downloads 2009-10-13
- Toshiba Satellite T135-S1300
- Thin-and-light laptops may look similar, but they're not all made the same. It's a deceptive world out there, especially since many thin-and-lights trade performance for a stylishly thin chassis, all while marketing a mainstream look that suggests performance equal to other notebooks.The Toshiba T135 is part of Toshiba's new T100...
- Product reviews 2009-10-09
- ShareWatcher Protection 1.2 (Windows)
- ShareWatcher protects your computer against viruses created by files downloaded from file-sharing software. The automatic scan function scans new files automaticly and compares it with the virus database updated 24/7. If the file contains viruses, you will be warned. ShareWatcher includes also a full download-directory scan function which scans files...
- Software downloads 2009-10-08
- Toshiba DMF82XKU 8-inch Digital Media Frame
- Digital frames can be divided into two categories: connected digital media frames and digital photo frames. The Toshiba DMF82XKU 8-inch Digital Media Frame, is--surprise--one of the former. It easily connects to a Wi-Fi network for access to photo collections from a variety of online sources as well as letting you...
- Product reviews 2009-10-07
Neighboring Terms
Premier Vendor Content Whitepapers, webcasts & resources from our Power Center Sponsors
-
-
Smart Tech
Expert advice on innovations in healthcare and the green technologies that make it happen.
Find out more
-
Smart Business
Discussion and advice on management issues that revolve around making your world smarter and more useful.
More Smart Advice
-
Smart People
The best and worst moves in the management and strategy trenches.
Learn More


