Database – What is Database Management System & Their Components



  • When we opened a file we must close such file, otherwise data will damage.
  • “fclose” function is used to close a file.
  • Example fclose(fp);

FUNCTIONS

IMPORTANCE OF FUNCTIONS:

  • A function is a piece of code written to perform a specific task.
  • Importance and Advantages are
  1. A large program can be divided into small units or modules. These are written as Functions.
  1. Each function is written to perform specific task. This makes writing and testing of program easier.
  1. Many programmers can work on one program at a time. So program develop quickly.
  1. A function can be use in other program.
  1. Use of functions also reduces overall length of the program.

TYPES OF FUNCTIONS:

  • Built-In Functions (These functions are defined already in the language. We can’t use these functions in any other program. Also called Library Functions. (i.e.) printf ( ), sqrt ( ) etc.).
  • User-Defined Functions (User creates these functions. Also called Programmer-Defined functions. These functions are written for a specific use).

TYPES OF VARIABLES:

Local Variables:

  • Variables that are declared inside the main function or inside any user-defined function are called Local variables or automatic variables
  • The keyword “auto” (optional) can be used to declare these variables.
  • Example

auto int a, b, c; or

int a, b, c;

Life-Time of Local Variables:

  • Life time is the time period between the creation and destruction of the variable.
  • When control goes to that function in which variable is declared, then variable will created and occupy memory space and when control goes back to calling function then variable will be destroyed.
  • A variable declared inside the function can not used in other function.

© Copyrights 2014. All rights are reserved www.latestcontents.com