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 / raj

3 is correct answer

Is This Answer Correct ?    24 Yes 7 No

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

Answer / pragathi

3 is the answer bcoz
i=1
num[i]=i++;
num[1]=2;
here i=2
printf("%d", num[2]);

here 3 is there at position 2 .
so answer is 3

Is This Answer Correct ?    19 Yes 3 No

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

Answer / lucky

out put is 3 and it is correct

Is This Answer Correct ?    18 Yes 3 No

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

Answer / vyasaraj.s

The output is 3

Is This Answer Correct ?    21 Yes 7 No

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

Answer / xyz

the answer will be 3 b'coz whatever the "num[i] = i++;"
this expression the output will be depend's on "i" and
at last i will be 2 and num[2]=3 which is the answer.

Is This Answer Correct ?    8 Yes 1 No

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

Answer / tk

Answer is :: 3

Explanation::

main()
{
int i = 1;
int num[] = {1,2,3,4};
num[i] = i++; // Here i = 1, so num[1] = 1; and num =
{1,1,3,4}
// After the execution of this statement the value of i
will be 2 (as i++)
printf("%d", num[i]); // num[2] = 3 so answer is 3
}
}

Is This Answer Correct ?    5 Yes 0 No

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

Answer / vinay

Idiots please don't give wrong answers. While you answer
the questions, please check the output practically and post

Is This Answer Correct ?    5 Yes 1 No

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

Answer / anusha raykar

Please dont answer with blind mind.

Answer is= 3

100%

Is This Answer Correct ?    4 Yes 0 No

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

Answer / prakruthi

ryt answer is 3 for sure

Is This Answer Correct ?    5 Yes 1 No

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

Answer / vijay

expression likes
num[i]=i++;
are always compiler dependent.
it is a bad programing to use such expression.

Is This Answer Correct ?    9 Yes 7 No

Post New Answer

More C Interview Questions

Why main function is special give two reasons?

0 Answers  


How can you print HELLO WORLD without using "semicolon"?

7 Answers   HCL, Infosys,


Is main is user defined function?

0 Answers  


what is meant by the "equivalence of pointers and arrays" in C?

3 Answers   Satyam,


There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.

1 Answers   HCL, iGate,






What is the mean of function?

0 Answers  


what is difference between C and C++

4 Answers  


to write a program, that finds the minimum total number of shelves, including the initial one, required for this loading process. The packets are named A, B, C, D, E …….. Any numbers of packets with these names could be kept in the shelf, as in this example: [ZZLLAAJKRDFDDUUGGYFYYKK]. All packets are to be loaded on cars. The cars are lined in order, so that the packets could be loaded on them. The cars are also named [A, B, C, D, E,………….].

2 Answers   Infosys, TCS,


1. main() { printf("%d",printf("HelloSoft")); } Output?

3 Answers   HCL,


what is the difference between while and do while?

2 Answers  


Why do we use int main instead of void main in c?

0 Answers  


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

0 Answers   Subex,


Categories