what will be the output of this program?
void main()
{
int a[]={5,10,15};
int i=0,num;
num=a[++i] + ++i +(++i);
printf("%d",num);
}

Answers were Sorted based on User's Feedback



what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++..

Answer / viswanath

Ans: 15.
Exp: a[++i] means i = 1; so 10 + 2 +3

Is This Answer Correct ?    7 Yes 1 No

what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++..

Answer / nandkishor

Ans: 19.
Explanation: First expression (++i) execute. Hence i=1;
Than a[++i]=a[2]=15.
And than ++i=3.
Hence evaluation will be 15+3+1=19.
Note that expression closed in braces have high precedence.

Is This Answer Correct ?    0 Yes 0 No

what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++..

Answer / soni narula

6

Is This Answer Correct ?    4 Yes 7 No

Post New Answer

More C Code Interview Questions

void main() { while(1){ if(printf("%d",printf("%d"))) break; else continue; } }

1 Answers  


4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }

2 Answers   Broadridge,


write a c program to Create a mail account by taking the username, password, confirm password, secret_question, secret_answer and phone number. Allow users to register, login and reset password(based on secret question). Display the user accounts and their details .

2 Answers  


#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

1 Answers  


how can i cast a char type array to an int type array

2 Answers  






What is the hidden bug with the following statement? assert(val++ != 0);

1 Answers  


main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\n”", x--); } } a. 4, 3, 2, 1, 0 b. 1, 2, 3, 4, 5 c. 0, 1, 2, 3, 4 d. none of the above

3 Answers   HCL,


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

0 Answers   IBM,


main() { printf("\nab"); printf("\bsi"); printf("\rha"); }

3 Answers  


Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

1 Answers  


write a program to count the number the same (letter/character foreg: 's') in a given sentence.

2 Answers  


main() { char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]); }

1 Answers   DCE,


Categories