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       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
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
what is the output of following question?

void main()
{
int i=0,a[3];
a[i]=i++;
printf("%d",a[i]
}
 Question Submitted By :: P_c_g
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is the output of following question? void main() { int i=0,a[3]; a[i]=i++; printf("%d",a[i] }
Answer
# 1
my opinion or wat i think is that , 
a[i]=i++; is given so...

here i++ is a post increment operation , so first it will assign the value to a[0]=0 , so a[0] will have 0 , and in next line a[i] is given in printf , so  the value a[1] should get printed that will be garbage value.......


thank u
 
Is This Answer Correct ?    2 Yes 1 No
Vignesh1988i
 
  Re: what is the output of following question? void main() { int i=0,a[3]; a[i]=i++; printf("%d",a[i] }
Answer
# 2
Vignesh, you are right about the post incerement operation. 
The a[i]=a[0] which will be assigned 0 but the printf will 
print 0 as output because its printing the a[0] and not a
[1].
 
Is This Answer Correct ?    0 Yes 0 No
Sha
 
 
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
What's wrong with "char *p; *p = malloc(10);"?  5
write a program to swap bits in a character and return the value prototype of function char fun (char a, charb flag c) where fun returns a char, char a is a the value char b is the bit to be changed and flag c is the bit value for eg: x=fun(45,7,0) since 45 is 0010 0101 and ow x should contain the value 65 (0110 0101) Bosch1
suppose we use switch statement and we intilize years name using enum statement like(jan,feb,mar,------dec) we take integer value as an input .question is that the month which we analyz is from 0 to 11 bt if i enter 12 than how he again starts from begning and print jan  1
how to display 2-D array elements in spiral  1
how to connect oracle in C/C++.  2
how to return 1000 variables from functio9n in c?plz give me code also  5
Average of a couple 10 years ago was 25. The average remains same after having a child and twins after 3 years. What is the present age of the first child IBM9
What is memmove? Oracle1
How to add two numbers without using arithmetic operators? Sapient11
fn f(x) { if(x<=0) return; else f(x-1)+x; } HCL3
print the following using nested for loop. 5 4 3 2 1 1 2 3 4 3 2 1 1 2 1 2 1 1 2 3 4 3 2 1 1 2 3 4 5  5
printf("%d",(printf("Hello")); What it returns? TCS23
if ENTERED FIVE DIGITS DESIGN A PROGRAM THAT WILL FIND CORRESPONDING VALUE FROM ASCII TABLE  1
YBJBU6  1
n=7623 { temp=n/10; result=temp*10+ result; n=n/10 } Wipro4
main() { printf("hello%d",print("QUARK test?")); }  4
array contains zeros and ones as elements.we need to bring zeros one side and one other side in single parse. ex:a[]={0,0,1,0,1,1,0,0} o/p={0,0,0,0,0,1,1,1} Motorola7
2. Counting in Lojban, an artificial language developed over the last fourty years, is easier than in most languages The numbers from zero to nine are: 0 no 1 pa 2 re 3 ci 4 vo 5 mk 6 xa 7 ze 8 bi 9 so Larger numbers are created by gluing the digit togather. For Examle 123 is pareci Write a program that reads in a lojban string(representing a no less than or equal to 1,000,000) and output it in numbers. Nagarro2
Would you rather wait for the results of a quicksort, a linear search, or a bubble sort on a 200000 element array? 1) Quicksort 2) Linear Search 3) Bubble Sort  2
We can draw a box in cprogram by using only one printf();& without using graphic.h header file? NIIT3
 
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