Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


void main()
{
int i=5;
printf("%d",i+++++i);
}

Answers were Sorted based on User's Feedback



void main() { int i=5; printf("%d",i+++++i); } ..

Answer / vinay,

:) its just how the Compiler parses things..

the..maximum matching (of a token) principle... from the
left..

1. i++ is a valid maximum match. Good, next
2. + match, next (expects a + or a identifier,for furthur
match)
3. + (this is not a identifier, but a + will do so:
match=++). Next the parser wants an indentifier.. else
compiler flags an error..
4. + (not an identifier.. so.. fails)

Is This Answer Correct ?    0 Yes 0 No

void main() { int i=5; printf("%d",i+++++i); } ..

Answer / ashwini

This gives an error. The error is as below:
error C2105: '++' needs l-value

if we correct the code to printf("%d", i++ + ++i);

We get the answer as 12...

The above printf becomes a statement when it sees the
semicolon. Unary operators have right to left associativity.
So, ++i is evaluated first to 6. Then, i++ is evaluated. i++
contributes 6 to addition and then increments i. So, we get
the answer as 12.

Is This Answer Correct ?    1 Yes 1 No

void main() { int i=5; printf("%d",i+++++i); } ..

Answer / shivam shukla

all of you are breaking the statement i+++++i correctly as
i++ + ++i and your answer 12 is also write but you are
explaining it the wrong way......first i++ will make the
value 6 and again a ++i will make it 7 but inn actual
calculation of i++ + ++i....5+7.....will be calculated
hence we get the value 12

Is This Answer Correct ?    0 Yes 0 No

void main() { int i=5; printf("%d",i+++++i); } ..

Answer / ashvin solanki (srimca college

There will be a compilation error .....

Is This Answer Correct ?    0 Yes 0 No

void main() { int i=5; printf("%d",i+++++i); } ..

Answer / shruti

i think it will give a compilation error..

Is This Answer Correct ?    1 Yes 2 No

void main() { int i=5; printf("%d",i+++++i); } ..

Answer / sulochana

This statement is just i=i++ + ++i;
Initially i=5
i++ increments after the statement completed For now its
value is 5.
++i increments before its execution.so it is 6
It executes like
i=5+6; i.e. i=11

Is This Answer Correct ?    2 Yes 8 No

void main() { int i=5; printf("%d",i+++++i); } ..

Answer / guest

the condition is like i++ + ++i

so 5 + 6 =11

Is This Answer Correct ?    10 Yes 25 No

Post New Answer

More C Interview Questions

what will be the output for the following main() { printf("hi" "hello"); }

5 Answers   RoboSoft,


write a program to display the numbers having digit 9 in the given range from 1 to 100

1 Answers  


how to make program without <> in library.

1 Answers   ADITI,


using only #include <stdio.h> and #include <stdlib.h> Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.

0 Answers  


Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.

0 Answers  


void main() { int i=5; printf("%d",i+++++i); }

17 Answers   ME,


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

0 Answers  


Difference between malloc() and calloc() function?

0 Answers  


A routine usually part of the operation system that loads a program into memory prior to execution a) linker b) loader c) preprocessor d) compiler

0 Answers  


what is the flow of execution in cprogram? ex:printf();,scanf();

2 Answers  


Find greatest number out of 10 number without using loop.

5 Answers   TCS,


Why void is used in c?

0 Answers  


Categories