[0]
Libraries in programming languages are collections of prewritten code that
users can use to optimize tasks.
[1]
In computer science, a library is a collection of non-volatile resources used
by computer programs, often for software development. These may include
configuration data, documentation, help data, message templates, pre-written
code and subroutines, classes, values or type specifications.
[2]
In very simple terms a library is a file that consists of some useful code.
This code could be a simple function or a collection of functions, variables,
classes, data structures. Generally a library is a code that will allow you to
interact with a particular aspect of the OS. e.g. libraries like stdio.h
A library could also be a collecction of mathematical or logical operations.
e.g. math.h
The general philosophy behind writing a library is to
Allow for code reuse
Provide access of some aspects of hardware/software.