main()

{

int a=2,*f1,*f2;

f1=f2=&a;

*f2+=*f2+=a+=2.5;

printf("\n%d %d %d",a,*f1,*f2);

}

Answers were Sorted based on User's Feedback



main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; pri..

Answer / odelu vanga

*f2=*f2+(*f=*f2+(a=a+2.5))

a=a+2.5=4
so *f2=4
*f2=*f2+4=8
now *f2=8
so *f2=*f2+8=16

ans:- 16 16 16

Is This Answer Correct ?    18 Yes 3 No

main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; pri..

Answer / susie

Answer :

16 16 16

Explanation:

f1 and f2 both refer to the same memory location a. So
changes through f1 and f2 ultimately affects only the value
of a.

Is This Answer Correct ?    6 Yes 3 No

main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; pri..

Answer / kamlesh meghwal

LOL@Govind Verma....how u r gettin 888..hehe..!!1

Is This Answer Correct ?    3 Yes 0 No

main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; pri..

Answer / forgot_my_name

Since we are modifying same variable three times in the same line (before sequence point ) so we broke the rules, so whatever compiler says would be right..
@Kamlesh Meghwal : In GCC compiler ans is 8 8 8.

Is This Answer Correct ?    1 Yes 0 No

main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; pri..

Answer / vamshikrishna

12 12 12

explanition.
printf takes the last updated value and prints for every var
i.e,

a=a+2.5=4
so f2=4
f2=f2+4=8
here again f2 =4 "since f2=&a"
so f2=f2+4=12

Is This Answer Correct ?    3 Yes 3 No

main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; pri..

Answer / govind verma

but ans is 888 but i dnt know how....

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Code Interview Questions

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

1 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,


main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }

2 Answers  


func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d !\n ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); }

1 Answers   Satyam,


How we print the table of 3 using for loop in c programing?

7 Answers  






I need your help, i need a Turbo C code for this problem.. hope u'll help me guys.? Your program will have a 3x3 array. The user will input the sum of each row and each column. Then the user will input 3 values and store them anywhere, or any location or index, temporarily in the array. Your program will supply the remaining six (6) values and determine the exact location of each value in the array. Example: Input: Sum of row 1: 6 Sum of row 2: 15 Sum of row 3: 24 Sum of column 1: 12 Sum of column 2: 15 Sum of column 3: 18 Value 1: 3 Value 2: 5 Value 3: 6 Output: Sum of Row 1 2 3 6 4 5 6 15 7 8 9 24 Sum of Column 12 15 18 Note: Your program will not necessary sort the walues in the array Thanks..

0 Answers  


main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }

1 Answers  


main() { int i=5; printf(ā€œ%dā€,i=++i ==6); }

1 Answers  


main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024

2 Answers   HCL,


main() { if (!(1&&0)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above

3 Answers   HCL,


Extend the sutherland-hodgman clipping algorithm to clip three-dimensional planes against a regular paralleiepiped

1 Answers   IBM,


what is variable length argument list?

2 Answers  


Categories