Hello everyone,
Newbie here, PLZ HELP.......
This is what I coded (it's very very simple, still I'm facing problem with this code) --------->
_______________ _______________ _______________ _______________ _____
[code=c]#include<conio. h>
#include<stdio. h>
int main()
{
int i=0;
int j=1;
clrscr();
printf("\n %d",i++ && ++j);
printf("\n %d %d",i,j);
getch();
return(0);
}[/code]
_______________ _______________ _______________ _______________ _____
**************
**OUTPUT**
**************
0
1 1
_______________ _______________ _______________ _______________ _____
I'm using Borland Turbo C++ 3.0.
I expect the code
printf("\n %d",i++ && ++ j);
to increment j by 1 and output 0 and then increment i by 1.
Now i becomes 1 and j becomes 2.
Now when the code below is executed
printf("\n %d %d",i,j);
I expect now that the code to print value of i and j as 1 and 2, but I get output as
1 1.
Where am I wrong, Please guide me.
_______________ _______________ _______________ _______________ _____
THANKS TO EVERYONE IN ADVANCE........ .......
Newbie here, PLZ HELP.......
This is what I coded (it's very very simple, still I'm facing problem with this code) --------->
_______________ _______________ _______________ _______________ _____
[code=c]#include<conio. h>
#include<stdio. h>
int main()
{
int i=0;
int j=1;
clrscr();
printf("\n %d",i++ && ++j);
printf("\n %d %d",i,j);
getch();
return(0);
}[/code]
_______________ _______________ _______________ _______________ _____
**************
**OUTPUT**
**************
0
1 1
_______________ _______________ _______________ _______________ _____
I'm using Borland Turbo C++ 3.0.
I expect the code
printf("\n %d",i++ && ++ j);
to increment j by 1 and output 0 and then increment i by 1.
Now i becomes 1 and j becomes 2.
Now when the code below is executed
printf("\n %d %d",i,j);
I expect now that the code to print value of i and j as 1 and 2, but I get output as
1 1.
Where am I wrong, Please guide me.
_______________ _______________ _______________ _______________ _____
THANKS TO EVERYONE IN ADVANCE........ .......
Comment