main()
{
int i = 1;
int num[] = {1,2,3,4};
num[i] = i++;
printf("%d", num[i]);
}

what will be the output?
}

Answers were Sorted based on User's Feedback



main() { int i = 1; int num[] = {1,2,3,4}; num[i] = i++; printf("%d", num[i])..

Answer / mortal

num[i] is num[1] and its reassigned as i++ that is 1 thus it
will print 1.
but im not at all sure about this..

Is This Answer Correct ?    2 Yes 10 No

main() { int i = 1; int num[] = {1,2,3,4}; num[i] = i++; printf("%d", num[i])..

Answer / sathya

num[i]=i+1
num[1]=1+1=2, but num[1] is 1.so there is a error...

Is This Answer Correct ?    4 Yes 13 No

Post New Answer

More C Interview Questions

Explain what are global variables and explain how do you declare them?

0 Answers  


What are the c keywords?

0 Answers  


How can I insert or delete a line (or record) in the middle of a file?

0 Answers  


Can stdout be forced to print somewhere other than the screen?

0 Answers  


if we take a number as a char then can we manipulate(add, subtract) on this number

2 Answers  






Evaluate the following: int fn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return fn(v/2)+2; else return fn(v-1)+3; } for fn(7); 1) 10 2) 11 3) 1

6 Answers  


what is c?

4 Answers   IBM, TCS,


The operation of a stair case switch best explains the a) or operation b) and operation c)exclusive nor operation d)exclusive or operation Which of the following is/are syntactically correct? a) for(); b) for(;); c) for(,); d) for(;;);

1 Answers   HCL, Public Service Commission,


what are two kinds of java

2 Answers  


What is a structure in c language. how to initialise a structure in c?

0 Answers  


Did c have any year 2000 problems?

0 Answers  


What are enums in c?

0 Answers  


Categories