no it is legal only... its working ....

On 7/21/11, Reynald Suz <[email protected]> wrote:
> I tried in Dev C++,code-B executes infinitely. Why?
>
> On Thu, Jul 21, 2011 at 4:13 PM, Gaurav Popli <[email protected]> wrote:
>
>> dont you think it is illegal using x=x-- or x=--x;??
>>
>> On Thu, Jul 21, 2011 at 2:56 PM, karthiga m <[email protected]>
>> wrote:
>> > in code  A using pr e- decrement  therefore i gets decremented when
>> > checking while condition so
>> > it will print as 9 8 7  6 5 4 3 2 1 .....
>> > in code B using post-decrement  it will prints like 9 8 7 6 5 4 3 2 1 0
>> > here why zero printing means while checking while condition x-- have
>> > previous value..therefore at tht time x-- is 1 so while condition
>> > executing and prints x value as zero.
>> >
>> > On 7/21/11, Reynald <[email protected]> wrote:
>> >> Code: A
>> >> int main()
>> >> {
>> >>     int x = 10;
>> >>     while ( x = --x)
>> >>     printf( " %d ", x);
>> >>     getchar();
>> >> }
>> >>
>> >> Code: B
>> >> int main()
>> >> {
>> >>     int x = 10;
>> >>     while ( x = x--)
>> >>     printf( " %d ", x);
>> >>     getchar();
>> >> }
>> >>
>> >> Does Code-A and Code-B work similar? Justify.
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "Algorithm Geeks" group.
>> >> To post to this group, send email to [email protected].
>> >> To unsubscribe from this group, send email to
>> >> [email protected].
>> >> 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 [email protected].
>> > To unsubscribe from this group, send email to
>> [email protected].
>> > 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 [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> Regards
> Reynald Reni
> Masters in Software Engineering
> CIT - India
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to