Re: [algogeeks] pre-post decrement

2011-08-08 Thread sukran dhawan
nice one

On Mon, Aug 8, 2011 at 11:51 PM, raj kumar  wrote:

> May be
>
> The increment/decrement operators needs to update the operand after the 
> sequence
> point , so they need an
> L-value. The unary operators such as -, +, won’t need L-value as operand.
> The expression *-(++i)* is valid .see this page and you will understand
> the pont
> http://geeksforgeeks.org/?p=9380
>
> thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] pre-post decrement

2011-08-08 Thread raj kumar
May be

The increment/decrement operators needs to update the operand after
the sequence
point , so they need an
L-value. The unary operators such as -, +, won’t need L-value as operand.
The expression *-(++i)* is valid .see this page and you will understand the
pont
http://geeksforgeeks.org/?p=9380

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] pre-post decrement

2011-08-08 Thread jagrati verma
i m using redhat n it is giving lvalue...

On Mon, Aug 8, 2011 at 11:38 PM, raj kumar  wrote:
> it's running fine on my machine you can check
>  z=(--i)--;
> even this works fine
> z=(--i)++;
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] pre-post decrement

2011-08-08 Thread sukran dhawan
i think the order of evaluation of such expressions is not defined in
standard c
say for ex
the expression printf("%d",i+i)
doesnt work in linux but works fine in windows

On Mon, Aug 8, 2011 at 11:38 PM, raj kumar  wrote:

> it's running fine on my machine you can check
>  z=(--i)--;
> even this works fine
>
> z=(--i)++;
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] pre-post decrement

2011-08-08 Thread raj kumar
it's running fine on my machine you can check
 z=(--i)--;
even this works fine
z=(--i)++;

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] pre-post decrement

2011-08-08 Thread jagrati verma
it'll also give lvalue..


On Mon, Aug 8, 2011 at 11:31 PM, raj kumar  wrote:
> @jagrati
> so why it works fine
> z=(--i)--;
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] pre-post decrement

2011-08-08 Thread raj kumar
@jagrati
so why it works fine
z=(--i)--;

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] pre-post decrement

2011-08-08 Thread jagrati verma
as i think -- op has right to left assocoativity so --(i--) so i--
will take palce 1st so aftr ; it'll b 9 so no dectement op for const
thats y it is giving lvalue error

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] pre-post decrement

2011-08-08 Thread sukran dhawan
increment  or decrement operators basically increment values and assigns the
value to a variable.so it expects a variable on the left hand side.so since
constants cannot be placed on left hand side it reports lvalue error

On Mon, Aug 8, 2011 at 11:12 PM, Anil Arya  wrote:

> @nitin no increment or decrement operation on constant value..It's
> invalid:)
>
>
> On Mon, Aug 8, 2011 at 10:47 PM, Nitin  wrote:
>
>> main()
>> {
>> int i=10;
>> int z;
>> z=--i--;
>> }
>> this gives an lvalue required error ,what i want to know is when the post
>> decrement gets executed then whether the expression should be --i or --10,as
>> it is --10 thats y its givin lvalue required error but y is it so as if we
>> increment or decrement using post or pre operator variable is updated not it
>> is replaced by value.???
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Anil Kumar Arya
> B.Tech  III year
> computer science & engineering
> M.N.N.I.T Allahabad.
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] pre-post decrement

2011-08-08 Thread Anil Arya
@nitin no increment or decrement operation on constant value..It's
invalid:)

On Mon, Aug 8, 2011 at 10:47 PM, Nitin  wrote:

> main()
> {
> int i=10;
> int z;
> z=--i--;
> }
> this gives an lvalue required error ,what i want to know is when the post
> decrement gets executed then whether the expression should be --i or --10,as
> it is --10 thats y its givin lvalue required error but y is it so as if we
> increment or decrement using post or pre operator variable is updated not it
> is replaced by value.???
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Anil Kumar Arya
B.Tech  III year
computer science & engineering
M.N.N.I.T Allahabad.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] pre-post decrement

2011-08-08 Thread Nitin
main()
{
int i=10;
int z;
z=--i--;
}
this gives an lvalue required error ,what i want to know is when the post
decrement gets executed then whether the expression should be --i or --10,as
it is --10 thats y its givin lvalue required error but y is it so as if we
increment or decrement using post or pre operator variable is updated not it
is replaced by value.???

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.