what is a ststic variable and stiticfunction
briefly explain with exmple and in which case we use
Answers were Sorted based on User's Feedback
Answer / subhashish sen
When a variable is declared with static keyword,its called
as static variable,means it retains its value across
different function calls.Its basically used for counting no
of objects created for a class in C++ and its initialized to
0 by default.
When a function declared as static,its called as static
function.It can only operate on static variables.
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / zubeir
Static variable is the one allocated statically, meaning
that, it is allocated once in the program space and exists
till the program space is deallocated (the close of the
application).
Note:- Some people get confused between stack allocation
and static allocaion. Both are different terms.
A static function is again the same concept with static
variable allocation, but here the allocation is not just a
variable but a function's 'activation frame'. The
activation frame, for now, consider the function's
information required by the compiler to execute the
function which is stored internally.
Is This Answer Correct ? | 1 Yes | 5 No |
What is encapsulation oop?
What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 2) 17 3) 16.5
#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; wow *b; a.x = 22; b = &a; a.x = 23; cout << b->x; return 0; }
to remove the repeated numbers from the given . i.e.., if the input is 12233 output should of 123
What is an interface in oop?
how do you handle yourself when you feel the wald is aganist you
I am developing a payroll system mini project.I used file concept in program for reading and writing.When the program is reloading into the memory that is if i execute next time the file was cleaned and adding data from the starting this is my problem.I want to strore the previous data and if i want to add any record that should be next of previous data.Please help me.
Write a program to accept a number and to print numbers in pyramid format? for eg:for a no. 5 1 212 32123 4321234 543212345
write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).
what does exactly the linker do?
how to swap the variables without using temp and operators
Why do we use encapsulation in oops?