what will be the output of the following program, justify?
#define TEST

int TEST getdata()
{
static i;
i+=10;
return i;

}

main()
{
int k;
k = getdata();
}


Answer Posted / rkr

The Static variable is initialized to zero
In the above program

static i; which is equivalent to static i = 0;
Next line i is incrementing by 10, then i value is 10.
return the value is 10

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are preprocessor directives?

642


What is main function in c?

569


What is the value of h?

622


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4189


What is the process to create increment and decrement stamen in c?

597






What is the difference between if else and switchstatement

1326


pierrot's divisor program using c or c++ code

1742


How can I split up a string into whitespace-separated fields?

581


Can we increase size of array in c?

554


Explain what is meant by 'bit masking'?

658


What is modeling?

659


What is the scope of global variable in c?

568


Does c have class?

625


Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

15076


How can a program be made to print the name of a source file where an error occurs?

747