Database – What is Database Management System & Their Components



Global Variables:

  • Variable that is declared outside the main function or any other function are called Global variables or External variables.
  • These variables can use any where in the program.

Life-Time of Global Variables:

  • These variables exist in the memory throughout the program execution.
  • When a program starts its execution these are created.
  • When program ends then these variables destroyed from memory.

Static Variables:

  • These variables are declared inside a function by using the keyword “Static”.
  • These can be used only in that function in which they are declared.
  • Life time is throughout the program.
  • Since static variables is initialized only once and is not destroyed, the function having static variables runs faster.
  • (e.g.) static int i=10;

PASSING ARGUMENTS TO FUNCTIONS:

  • Two ways of passing arguments are

Argument Passed by Value(In this method, value of the variable is passed to the function).

Argument Passed by Reference(It is also called “passing by address”. In this method, the memory address or reference of the variable is passed to the function. & sign is used with actual parameter).

 

About Saweel Ur Raheem

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