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

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() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }

1 Answers  


main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user

2 Answers   HCL,


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,


main() { char *p; p="%d\n"; p++; p++; printf(p-2,300); }

1 Answers  






posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come

2 Answers   GATE,


#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }

2 Answers  


Sir... please give some important coding questions asked by product companies..

0 Answers  


why array index always strats wuth zero?

2 Answers  


main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }

1 Answers  


#include<stdio.h> main() { const int i=4; float j; j = ++i; printf("%d %f", i,++j); }

1 Answers  


main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }

3 Answers  


Categories