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

How can I get random integers in a certain range?

619


What is a memory leak? How to avoid it?

580


Is it better to use a macro or a function?

659


Do you have any idea about the use of "auto" keyword?

670


What does sizeof int return?

597






How do you use a 'Local Block'?

728


How can you return multiple values from a function?

638


What is assert and when would I use it?

585


Where does the name "C" come from, anyway?

648


any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()

697


Write a program to show the change in position of a cursor using c

585


Write a program to swap two numbers without using a temporary variable?

613


Write a program to use switch statement.

662


hi, which software companys will take,if d candidate's % is jst 55%?

1669


What is meant by preprocessor in c?

540