ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
proc() {

	static i=10;
	printf("%d",i);
	}

	If this proc() is called second time, what is the output? 
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output?
Answer
# 1
11
 
Is This Answer Correct ?    1 Yes 2 No
Guest
 
  Re: proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output?
Answer
# 2
I dont know how can it be 11 next time.
I agree that static variables are assigned only once, and
allocation is happening to the data segment, but it doesnt
mean that is going to change the value on its own, until u
do that manually. 

U call this program for n times, the answer is going to be 10.
 
Is This Answer Correct ?    2 Yes 1 No
Sujith
 
 
 
  Re: proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output?
Answer
# 3
the answer is 10 bcoz no increment statement in that loop. if 
increment statement is there then definitely the value of 
static variable is increased. otherwise it is fixed.
 
Is This Answer Correct ?    2 Yes 0 No
Suchita
 
  Re: proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output?
Answer
# 4
does static function increment the counter variable by 
one?? if not then how can u say that i value will be 
incremented by 1.
finally the i value will be 10 only. it will not 
increment.
 
Is This Answer Correct ?    1 Yes 0 No
Saurabh
 
  Re: proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output?
Answer
# 5
if it is called for second time also ,it will be 10 only but
in  a different thought....

static keyword is only one time initilization....if the
compailer when again reads the same line it blindly ignores
it and print the latest value of yhat static variable
 
Is This Answer Correct ?    1 Yes 0 No
Vignesh1988i
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what is the output of the following code? main() { int I; I=0x10+010+10; printf("x=%x",I); } give detailed reason  3
HOW TO SWAP TWO NOS IN ONE STEP? Satyam12
main() { printf(5+"good morning"); printf("%c","abcdefgh"[4]); }the o/p is morning and e...how someone explain  1
program to find which character is occured more times in a string and how many times it has occured? for example in the sentence "i love india" the output should be i & 3.  3
Design a program using an array that searches a number if it is found on the list of the given input numbers and locate its exact location in the list.  3
what will happen if you free a pointer twice after allocating memory dynamically ? Novell2
#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2 = 5; printf ( "\n The sum is :%d", value1 | value2 ); } This is the answer asked by some one to add two numbers with out using arithmetic operator?Yes this answer is write it given out put as 15.But how????? what is need of following line? int main ( int argc, char* argv [ ] ) how it work?what is the meaning for this line? please explain me.Advance thanks Excel4
write a function for strtok()?? Verifone1
Write a Program to print this triangle: * ** * **** * ****** * ******** * ********** use two nested loops. TCS6
What is macro? IBM4
Find string palindrome 10marks Honeywell5
Can we access RAM? How? Whats the range of access? Similarly What are other hardware we can access?  1
ABCDCBA ABC CBA AB BA A A  1
Write a program to find the smallest and largest element in a given array in c language Microsoft3
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } CitiGroup7
write a “Hello World” program in “c” without using a semicolon?  3
void main() { int i=5; printf("%d",i++ + ++i); } ME11
main() { clrscr(); } clrscr(); ME3
where does malloc() function get the memory?  1
How do I declare a pointer to an array?  5
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com