¦void main()
¦{
¦int i=10,j;
¦ j=i+++i+++i;
¦printf("%d",j);
¦getch();
¦}
¦ output:-30
but in same question if we write as-
¦void main()
¦{
¦int i=10;
¦ int j=i+++i+++i;
¦printf("%d",j);
¦getch();
¦}
¦ output:-33
why output is changed from 30 to 33. Can any body answer...

Answers were Sorted based on User's Feedback



¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d&..

Answer / ram

no change same answer for both as 30.

Is This Answer Correct ?    0 Yes 0 No

¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d&..

Answer / manikandan

ithink cannot use void in main().becoz returns integer. and output of this 2 program is 30 only.not print 33

Is This Answer Correct ?    2 Yes 3 No

¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d&..

Answer / abhishek kumar

this question is itself is confusing question as if we
compile it with c,c++ compiler, the compiler itself get
confuse and it take i=10 all time as it does not make
distinguish between operator in expression(i+++i+++i) and
give output as 30, but if we compile it with java compiler
it output is 33, as java compiler make distinguish between
operator as (i++ +i+ ++i).

so my conclusion is that question given above is confusing
itself that why output are varying every time.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C Code Interview Questions

Question: We would like to design and implement a programming solution to the reader-writer problem using semaphores in C language under UNIX. We assume that we have three readers and two writers processes that would run concurrently. A writer is to update (write) into one memory location (let’s say a variable of type integer named temp initialized to 0). In the other hand, a reader is to read the content of temp and display its content on the screen in a formatted output. One writer can access the shared data exclusively without the presence of other writer or any reader, whereas, a reader may access the shared memory for reading with the presence of other readers (but not writers).

1 Answers  


main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above

3 Answers   BrickRed, HCL,


What is the output for the program given below typedef enum errorType{warning, error, exception,}error; main() { error g1; g1=1; printf("%d",g1); }

1 Answers  


void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }

3 Answers  


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

1 Answers  






main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

2 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  


What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }

1 Answers  


Is the following code legal? struct a { int x; struct a b; }

1 Answers  


#include<stdio.h> main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); }

1 Answers  


What is "far" and "near" pointers in "c"...?

3 Answers  


struct Foo { char *pName; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); strcpy(obj->pName,"Your Name"); printf("%s", obj->pName); } a. Your Name b. compile error c. Name d. Runtime error

3 Answers   HCL,


Categories