What is meant byStatic Variable ?
Answers were Sorted based on User's Feedback
A static can only be accessed from the function in which it
was declared, like a local variable. The static variable is
not destroyed on exit from the function, instead its value
is preserved, and becomes available again when the function
is next called. Static variables are declared as local
variables, but the declaration is preceeded by the word
static.
Is This Answer Correct ? | 7 Yes | 2 No |
static variable or method is not accessable outside the
class where it has been declared.
Is This Answer Correct ? | 3 Yes | 3 No |
Answer / rutuja gaikwad
static variable is a variable which declared inside class
using keyword static.
its value used only in that class not overall program
example:
#include <stdio.h>
void func() {
static int x = 0; // x is initialized only once
across three calls of func()
printf("%d\n", x); // outputs the value of x
x = x + 1;
}
int main(int argc, char * const argv[]) {
func(); // prints 0
func(); // prints 1
func(); // prints 2
return 0;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / kanchan
static variables are those which are not change through out
the program and remain constant.
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / ahmed eldesokey
static variable :
is initialize while loading the programme in the memory and
doesn't destroyed during the running time.
simply it's loaded in the memory during the lifetime of the
program
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / addy
static variable means who's value is constant through out
the program.
Is This Answer Correct ? | 0 Yes | 6 No |
suppose we have ten members of a physical file but we want the output of last 5 members only.how to achieve that?
How to print No.of.rows affected after updation using ADO.Net
Explain with examples any 2 features of OOPS.
0 Answers Tavant Technologies, Verifone,
what is polymorphism in java.
How to rename A1-A30 datasets into B1-B30 using macros?
what is programming language?
How to get the index of the clicked field in reports in ABAP?
what is dot net framework
hai i like to do some certifications in programming or any other......... am doing my IT third year......... pls guide me...... mail me ur suggestions to ranjithmaharaj@gmail.com...
what is the difference between Windows application and Unix application?
shall we execute our java programmes in jre
Given an array of size n+1 which contains all the numbers from 1 to n.Find the number which is repeated in O(n) time.How do you proceed with the same with floating numbers from 0 to 1 instead of 1 to n?