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

Write, efficient code for extracting unique elements from a sorted list of array. e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).

13 Answers   Intel, Microsoft, TCS,


Give a one-line C expression to test whether a number is a power of 2.

10 Answers   Microsoft,


Design an implement of the inputs functions for event mode

0 Answers   Wipro,


programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h

1 Answers  


main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }

1 Answers  






To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates.

19 Answers   Amazon, BITS, Microsoft, Syncfusion, Synergy, Vector,


Predict the Output: int main() { int *p=(int *)2000; scanf("%d",2000); printf("%d",*p); return 0; } if input is 20 ,what will be print

2 Answers  


how to return a multiple value from a function?

5 Answers   Wipro,


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  


main( ) { static int a[ ] = {0,1,2,3,4}; int *p[ ] = {a,a+1,a+2,a+3,a+4}; int **ptr = p; ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *++ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); ++*ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); }

2 Answers   Persistent,


#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }

1 Answers  


#define max 5 #define int arr1[max] main() { typedef char arr2[max]; arr1 list={0,1,2,3,4}; arr2 name="name"; printf("%d %s",list[0],name); }

1 Answers  


Categories