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

What is wrong with this declaration?

0 Answers  


What is a class?

3 Answers  


what is difference between overriding and overloading?

1 Answers  


#include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); } what is the output for this?

4 Answers   IIIT,


What is sizeof array in c?

0 Answers  






Subtract Two Number Without Using Subtraction Operator

0 Answers  


please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i); printf("%d",i); getch(); }

3 Answers  


How can you access memory located at a certain address?

0 Answers  


What is a 'null pointer assignment' error?

0 Answers  


what is the use of operator ^ in C ? and how it works?

2 Answers  


Will Macros support multiple arguments ?

7 Answers   Oracle,


What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; main() { BAD g1; g1=1; printf("%d",g1); }

4 Answers   ADITI,


Categories