শুক্রবার, ১৭ সেপ্টেম্বর, ২০১০

11. LIBRARY FUNCTIONS

A library function is a function that carry out various commonly used operations, but it is not part of the program itself.Some functions return a data item to their access point; others indicate whether a condition is true or false by returning a 1 or a 0, respectively; still others carry out specific operations on data items but do not return anything. Features which tend to be computer-dependent are generally written as library functions. Libraries save programmers the bother of writing code to do the same tasks time and time again; in short, libraries encourage code reuse.
   For example, there are library functions that carry out standard input/output operations, functions that perform operations on characters, functions that perform operations on strings and functions that carry out various mathematical calculations. Other kinds of library functions are also available.
   There are two main types of libraries: static libraries that are read by the compiler at compile-time and bound into the final version of the executable code; and dynamic libraries that are referred to by name to the compiler but the code is not actually incorporated into the executable until the program is run. One advantage of dynamic libraries is that they can be updated without having to update the program that calls them.
   A library function is accessed simply by writing the function name, followed by a list of arguments that represent information being passed to the function. The arguments must be enclosed in parentheses and separated by commas. The arguments can be constants, variable names, or more complex expressions. The parentheses must be present, even if there are on arguments.
   A function that returns a data item can appear anywhere within an expression, in place of a constant or an identifier. A function that carries out operations on data items but does not return anything can be accessed simply by writing the function name, since this type of function reference constitutes an expression statement.

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন