extern static int i
func()
{
i =10;
i++;
printf("%d \n",i);
}
main()
{
i =20;
printf("%d \n",i);
func();
printf("%d \n",i);

}

Answers were Sorted based on User's Feedback



extern static int i func() { i =10; i++; printf("%d \n",i); } main() { i ..

Answer / vadivelt

Program should give compiler error. Cos, u r trying to
allocate two different storage area to sigle int
variable 'i'.

ie.,
The below statement is invalid.
extern static int i;

Is This Answer Correct ?    8 Yes 1 No

extern static int i func() { i =10; i++; printf("%d \n",i); } main() { i ..

Answer / ashwini prakash

output will be..
20
11
20

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More C Interview Questions

what are the static variables

8 Answers   HCL, iFlex, TCS, Wipro,


write the program for maximum of the following numbers? 122,198,290,71,143,325,98

5 Answers  


What's the difference between constant char *p and char * constant p?

0 Answers   Celstream,


Does c have class?

0 Answers  


Explain the use of fflush() function?

0 Answers  






Define Spanning-Tree Protocol (STP)

0 Answers  


#ifdef TRUE int I=0; #endif main() { int j=0; printf("%d %d\n",i,j); }

3 Answers   ADITI,


can we write a c program with out using main

3 Answers  


can we implement multi-threads in c.

0 Answers  


Is there something we can do in C but not in C++? Declare variable names that are keywords in C++ but not C.

2 Answers   Infosys,


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

0 Answers  


Write a Program to accept different goods with the number, price and date of purchase and display them

0 Answers   HDFC,


Categories