what are the static variables
Answers were Sorted based on User's Feedback
Answer / nil
Static vairiable is one which can be accessed without
creation of an object of Class i.e. by direct calling calss.
| Is This Answer Correct ? | 9 Yes | 0 No |
Answer / prakash.m
static variables are those which retains the outcoming
value after 'n' iterations(initialized once)
(see below)
#include <stdio.h>
int g = 10;
main(){
int i =0;
void f1();
f1();
printf(" after first call \n");
f1();
printf("after second call \n");
f1();
printf("after third call \n");
}
void f1()
{
static int k=0; //static variable
int j = 10; //auto variable
printf("value of k %d j %d",k,j);
k=k+10;
}
the output will be:
value of k 0 j 10 after first call
value of k 10 j 10after second call
value of k 20 j 10after third call
hope this will help u....
| Is This Answer Correct ? | 7 Yes | 3 No |
Answer / smriti patnaik
static variables are variables that are initiated only once
in a memory,suppose u have initiated a variable as static
everytime u visit a iteration the value is changed 4m the
initialised value,not like auto variables where the values
remain same everytime u visit a iteration
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / nitin gupta
a static variable is shared by all the the instances of a
class.
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / subha raman
I have a doubt..what is the difference between.."static"
and "constant(const)"??
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / guest
Variables that statically retain their memeory location
across function calls or in other words even beyond their
scope.
Global static values or functions are used to hide them
from other files in the program.
| Is This Answer Correct ? | 0 Yes | 2 No |
Write a c pgm for leap year
11 Answers College School Exams Tests, IBM, TCS,
3. Program to print all possible substrings. ex: String S St Str Stri Strin String t tr tri trin tring r
Explain why c is faster than c++?
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
What is the result main() { char c=-64; int i=-32 unsigned int u =-16; if(c>i){ printf("pass1,"); if(c<u) printf("pass2"); else printf("Fail2");} else printf("Fail1); if(i<u) printf("pass2"); else printf("Fail2") } a)Pass1,Pass2 b)Pass1,Fail2 c)Fail1,Pass2 d)Fail1,Fail2 e)none
What does the c preprocessor do?
What is FIFO?
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
AMMONG THE 4 STROAGE CLASSES IN C, WHICH ONE FASTEST?
What is the difference between null pointer and void pointer
10 Answers CTS, Manforce, MAQ Software,
What is difference between stdio h and conio h?
Why static is used in c?