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 |
What are the Short cut Keys of Tally ERP?
kindly send interview materials
swap two number wthout using third variable
Given n red balls and m blue balls and some containers, how would you distribute those balls among the containers such that the probability of picking a red ball is maximized, assuming that the user randomly chooses a container and then randomly picks a ball from that.
public static void main(String args[]) describe it
A, B and C are 8 bit nos. They are as follows: A 1 1 0 1 1 0 1 1 B 0 1 1 1 1 0 1 0 C 0 1 1 0 1 1 0 1 Find ( (A-B) u C )=? how to solve this need with steps
CPU - abbrevation
In java without use of main() how to execute the program
How to swap two String values without using a third variable?
Write a pseudo code to evaluate a number to any base given (2...16) based on the input. Number greater than 9 should be given as A-F for 10-15.
this question is from sas:what is the difference between FILE and INFILE statements? plz explain in brief?
How to update a data for the views in the relational data base schema