this will help you
try the following :-
*p++
(*p)++
*(p++)
++*p
*++p
all your confusions will flushed out :)
On Mon, Jul 4, 2011 at 1:25 PM, Deoki Nandan wrote:
> when u use post increment operator in an expression and there is sequence
> point like || or && then value of post increment counted
thanx guys...
On Mon, Jul 4, 2011 at 5:11 PM, mahesh.jnumc...@gmail.com <
mahesh.jnumc...@gmail.com> wrote:
> In while loop, the value of i will be used as 0 as it is post decrement so
> the value of i will decrement after the while loop is executed.
> so 0!=0 will fail and the value of i will g
In while loop, the value of i will be used as 0 as it is post decrement so
the value of i will decrement after the while loop is executed.
so 0!=0 will fail and the value of i will get decrement and will be printed
as -1.
On Mon, Jul 4, 2011 at 3:54 PM, amit the cool wrote:
> main()
> {
> int i=0
in this actually whats happening is :
int i=0;
while((i--)!=0)
i-=i++;
printf("%d\n",i);
here when i is compared to 0 i is 0 and then it is decremented to -1, while
loop never gets executed.
On Mon, Jul 4, 2011 at 3:54 PM, amit the cool wrote:
> main()
> {
> int i=0;
> while(+(+i--)!=0)
> i-
On Mon, Jul 4, 2011 at 3:54 PM, amit the cool wrote:
> main()
> {
> int i=0;
> while(+(+i--)!=0)
>
Here the value passed of i is 0 only. So the next statement does not
execute. But after using, I gets decremented to -1
> i-=i++;
> printf("%d",i);
> }
>
> output sud be 1
> bt it is -1;
> why??
>
>
main()
{
int i=0;
while(+(+i--)!=0)
i-=i++;
printf("%d",i);
}
output sud be 1
bt it is -1;
why??
--
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,
when u use post increment operator in an expression and there is sequence
point like || or && then value of post increment counted in expression other
wise not
On Mon, Jul 4, 2011 at 11:24 AM, Navneet Gupta wrote:
> I think one rule of thumb for reading pre and post increment operators is
>
> 1)
I think one rule of thumb for reading pre and post increment operators is
1) For Pre - Increment the value and use it (++x)
2) For Post - Use the value and increment it (x++)
Similar is for pre and post decrement.
I am not very good at commenting the generality of above but in simple
usages like
y=*x++;
this line executes like this:
y=*x;
x=x+1; // post increment
Regards
Anantha Krishnan
On Mon, Jul 4, 2011 at 10:36 AM, amit kumar wrote:
> i think d answer sud be 10.
> but it comes out to be 5.
> xplain plz
>
>
> On Mon, Jul 4, 2011 at 10:30 AM, Sandeep Jain wrote:
>
>> Apoorve, pleas
i think d answer sud be 10.
but it comes out to be 5.
xplain plz
On Mon, Jul 4, 2011 at 10:30 AM, Sandeep Jain wrote:
> Apoorve, please explain the reason for this output as well
>
>
> Regards,
> Sandeep Jain
>
>
>
>
>
> On Mon, Jul 4, 2011 at 1:06 AM, Apoorve Mohan wrote:
>
>> 5
>>
>>
>> On Mon
Apoorve, please explain the reason for this output as well
Regards,
Sandeep Jain
On Mon, Jul 4, 2011 at 1:06 AM, Apoorve Mohan wrote:
> 5
>
>
> On Mon, Jul 4, 2011 at 1:01 AM, amit the cool wrote:
>
>> int main()
>> {
>>int a[]={5,10,15,8};
>>int *x=a;
>>int y;
>>
5
On Mon, Jul 4, 2011 at 1:01 AM, amit the cool wrote:
> int main()
> {
>int a[]={5,10,15,8};
>int *x=a;
>int y;
>y=*x++;
>printf("%d",y);
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To
int main()
{
int a[]={5,10,15,8};
int *x=a;
int y;
y=*x++;
printf("%d",y);
}
--
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 unsubscri
main()
{
char *p="hai friends",*p1;
p1=p;
while(*p!='\0') ++*p++;
printf("%s %s",p,p1);
}
--
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 em
14 matches
Mail list logo