# c problem



## arpanmukherjee1 (Jan 22, 2010)

hello

i want to know how the Turbo cpp (yes, the dinosaur one) and g++ give different output:

```
a=10
++a + ++a = 24 (g++)  & 23 (TC)
a++ + a++ = 20
++a - a++ = 0 (g++) & -1(TC)
```

please explain pre and post increment and decrement in this prgs.

also please tell how to obtain output of such prgs

one more thing -> if in expression pre and post increment occure together what is the precedence order??


----------



## arpanmukherjee1 (Jan 27, 2010)

\help!!!

tell me something!!!


----------



## Apple Juice (Jan 28, 2010)

u sud not worry abt dat output. from a compiler to compiler the output get different due 2 de implementation. dat is why TC and gcc giv diff o/p. 

check dis out, i got it from some1
*tinyurl.com/yexbgmy

u sud knoe tc is for nuubs  i dont wants 2 hurts u but dat is de way


----------



## arpanmukherjee1 (Jan 30, 2010)

Apple Juice said:


> u sud not worry abt dat output. from a compiler to compiler the output get different due 2 de implementation. dat is why TC and gcc giv diff o/p.
> 
> check dis out, i got it from some1
> *tinyurl.com/yexbgmy
> ...



yep,i want 2 find how the compiler generates it???


----------



## Apple Juice (Jan 31, 2010)

arpanmukherjee1 said:


> yep,i want 2 find how the compiler generates it???


uz gcc there you cn pass commandd:

```
gcc -S filename.c
```
you cn alsoo see the output in the filename.s file. it shows assembler o/p wcih teh compiler generates and then links 

i dnt knw howw tc generates the code  bt itz 4 nuuub neway


----------



## arpanmukherjee1 (Feb 7, 2010)

^thnks

BTW i think GDB might also help


----------

