@ atul...got nw..thnx

On Thu, Jan 26, 2012 at 11:26 PM, atul anand <[email protected]>wrote:

> think in terms of pointers...
>
> they are same :-
>
> p[-1] = *(p - 1)
>
>
> On Thu, Jan 26, 2012 at 11:15 PM, rahul sharma <[email protected]>wrote:
>
>> [-1] in end is same as -1 ??????
>>
>>
>> On Thu, Jan 26, 2012 at 11:11 PM, atul anand <[email protected]>wrote:
>>
>>> btw your compiler has sizeof(int)=4;
>>> thats why o/p = fg
>>>
>>> On Thu, Jan 26, 2012 at 11:09 PM, atul anand <[email protected]>wrote:
>>>
>>>> output depends on sizeof(int)....so it may be different if you run on
>>>> different compilers.
>>>>
>>>> considering *sizeof(int) = 2;*
>>>>
>>>> argv[] is array of pointers.
>>>>   (p+=sizeof(int))[-1];
>>>> p=p+2 // 2=sizeof(int);
>>>>
>>>> now p will be pointing at index *argv[2];
>>>> then you are doing....
>>>>
>>>> p=p-1;
>>>>
>>>> i.e p will point to *argv[1]
>>>>
>>>> hence output will be
>>>> o/p = cd
>>>>
>>>> On Thu, Jan 26, 2012 at 10:53 PM, rahul sharma <[email protected]
>>>> > wrote:
>>>>
>>>>> #include<stdio.h>
>>>>> #include<conio.h>
>>>>> void fun(char **);
>>>>>
>>>>> int main()
>>>>> {
>>>>>     char *argv[]={"ab","cd","de","fg"};
>>>>>     fun(argv);
>>>>>     getch();
>>>>>     return 0;
>>>>> }
>>>>>
>>>>> void fun(char **p)
>>>>> {
>>>>>      char *t;
>>>>>      t=(p+=sizeof(int))[-1];
>>>>>      printf("%s\n",t);
>>>>> }
>>>>>
>>>>> o/p: fg
>>>>>
>>>>> can nyone xplain
>>>>>
>>>>> the 2nd statement in fun?????
>>>>>
>>>>>  --
>>>>> 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.
>>
>
>  --
> 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