simpleoutput is same as expected
9 8 7 6 5 4 3 2 1
9 8 7 6 5 4 3 2 1 00
On Fri, Jul 22, 2011 at 8:14 AM, naveen ms wrote:
> ya...it(the 2nd part) is going to infinite loop in dev c++...it is
> printing 10 10 10.n going on..
>
> --
> You received this message because you are subscribed t
ya...it(the 2nd part) is going to infinite loop in dev c++...it is
printing 10 10 10.n going on..
--
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 gr
Certainly Aman.
The concepts of pre and post increment still stand correct.
while (x = --x) will terminate after x = 1 and when encountered (x = --x) =>
x = 0 (after testing condition). Thus, 0 will not be printed.
while (x = x--) will terminate after x = 0 and when encountered (x = x--) =>
x= -
My mistake, i forgot to initiate x.
Sorry for the mistake. But for devc it is infinite, then should we ignore
that?
On Thu, Jul 21, 2011 at 7:40 PM, poised wrote:
> Both the codes work perfectly on Ubuntu 11.04. (gcc)
>
> first code gives 0 in output.
> second one doesn't give 0 in output.
>
>
Both the codes work perfectly on Ubuntu 11.04. (gcc)
first code gives 0 in output.
second one doesn't give 0 in output.
both work as intended.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To view this discussion on the web visit
https:/
i tried in gcc of Ubuntu and its working fineits not goin infinite ...
On Thu, Jul 21, 2011 at 6:44 AM, Aman Goyal wrote:
> I think it is kind of illegal to use it, cos i tried this code on gcc
> compiler oof ubuntu(code b) and the result is infinite loop, which doesnt go
> with our logic at
I think it is kind of illegal to use it, cos i tried this code on gcc
compiler oof ubuntu(code b) and the result is infinite loop, which doesnt go
with our logic at all.
On Thu, Jul 21, 2011 at 5:45 PM, karthiga m wrote:
> no it is legal only... its working
>
> On 7/21/11, Reynald Suz wrote
no it is legal only... its working
On 7/21/11, Reynald Suz wrote:
> I tried in Dev C++,code-B executes infinitely. Why?
>
> On Thu, Jul 21, 2011 at 4:13 PM, Gaurav Popli wrote:
>
>> dont you think it is illegal using x=x-- or x=--x;??
>>
>> On Thu, Jul 21, 2011 at 2:56 PM, karthiga m
>> wr
I tried in Dev C++,code-B executes infinitely. Why?
On Thu, Jul 21, 2011 at 4:13 PM, Gaurav Popli wrote:
> dont you think it is illegal using x=x-- or x=--x;??
>
> On Thu, Jul 21, 2011 at 2:56 PM, karthiga m
> wrote:
> > in code A using pr e- decrement therefore i gets decremented when
> > ch
dont you think it is illegal using x=x-- or x=--x;??
On Thu, Jul 21, 2011 at 2:56 PM, karthiga m 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
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..ther
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 subscr
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 subscr
13 matches
Mail list logo