Skip to main content

Posts

Showing posts with the label Variable

Variables In Programming Language

A variable is a symbolic name for a memory location in which data can be stored and subsequently recalled. Variables are used for holding data values so that they can be utilized in various computations in a program. All variables have two important attributes: · A type which is established when the variable is defined (e.g., integer, real, character). Once defined, the type of a C++ variable cannot be changed. · A value which can be changed by assigning a new value to the variable. The kind of values a variable can assume depends on its type. For example, an integer variable can only take integer values (e.g., 2, 100, -12).

Finding maximum value of an array in C++

In the following program you can find maximum value of an array: #include <iostream> using namespace std; int min(int*, int); int main() {     int array[]={66,44,88,11,77,33,99,55,22};     cout<< "min(array,9)=" << min(array,9); } int min(int* array, int n) {     int m=array[0];     for(int i=1;i<n;i++)     if (array[i]>m) m=array[i];     return m; }

Properties of Static variable

Properties of Static variable are given bellow: A. Stored in data segment. B. Has initial default value zero. C. Known within the function on layer it is declared. D. It can only as the program lives after it is declared